pingvinius
pingvinius

Reputation: 421

How can I find out when Visual Studio theme color changes?

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.

Upvotes: 7

Views: 1847

Answers (2)

Cameron
Cameron

Reputation: 98736

If you want to detect the theme change event itself, you can make use of the VSColorTheme.ThemeChanged static event.

Upvotes: 2

pingvinius
pingvinius

Reputation: 421

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!

Upvotes: 10

Related Questions