Allow styles to be extended #316
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed #135.
You can now extend the custom Visual Studio-themed styles. This required a few changes:
First, the resource dictionary needed to be compiled like any other XAML file by including it as a
Page.Doing that meant the
xmlnsattributes for theMicrosoft.VisualStudio.Shell.15.0assembly could no longer be used. This is because in the v14 version of the toolkit, that assembly doesn't exist, and is actuallyMicrosoft.VisualStudio.Shell.14.0. We were previously working around that by loading the XAML file from the embedded resources, doing some string replacement, and then parsing the file as a XAML file. I've solved this problem be creating an internal class calledInternalResourceKeysin which we effectively alias the properties fromMicrosoft.VisualStudio.Shell.xx.0that we need to use.For example,
VsResourceKeys.TextBoxStyleKeydefines the key of the style for theTextBoxcontrol that we extend inThemeResources.xaml(previously accessed asshell:VsResourceKeys.TextBoxStyleKey). TheInternalResourceKeysclass has a property calledVsResourceKeys_TextBoxStyleKeywhich simply returns the value ofVsResourceKeys.TextBoxStyleKey, and inThemeResources.xamlwe now uselocal:VsResourceKeys_TextBoxStyleKey.I've also added
CustomizedStylesDialogto the demo extension to demonstrate how the styles can be extended. There are two examples:TextBoxstyle.Buttonstyle.You can access that dialog via the Theme Window tool window.