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

我只是一个虾纸丫 提交于 2019-12-12 08:06:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!