问题
I develop the Visual Studio package with a tool window. The UI of the tool window is based on WPF. In my user control I want to use current Visual Studio theme colors corresponding to the VS design.
Therefore my question is how I can find out that Visual Studio theme color has been changed?
Thanks in advance.
回答1:
I've found another way to do it. I can use visual studio theme colors resources from xaml directly. For example:
Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}"
where vsfx is
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
This approach solved this problem!
回答2:
If you want to detect the theme change event itself, you can make use of the VSColorTheme.ThemeChanged static event.
来源:https://stackoverflow.com/questions/7231186/how-can-i-find-out-when-visual-studio-theme-color-changes