How can I find out when Visual Studio theme color changes?
-
15-01-2021 - |
Question
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.
Solution
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!
OTHER TIPS
If you want to detect the theme change event itself, you can make use of the VSColorTheme.ThemeChanged
static event.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow