How do I know when the color of a Visual Studio theme changes?

I am developing a Visual Studio package using a tool window. The tool window user interface is based on WPF. In my control, I want to use the current colors of the Visual Studio theme that match the VS project.

So my question is, how can I find out if the color of the Visual Studio theme is changed?

Thanks in advance.

+7
source share
2 answers

I found another way to do this. I can use resources to draw themes for visual studio directly from xaml. For example:

Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}" 

where vsfx

 xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0" 

This approach solved this problem!

+10
source

If you want to define the theme change event yourself, you can use the static event VSColorTheme.ThemeChanged .

+2
source

All Articles