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

  • Question

  • Hello,

    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.

    Monday, August 29, 2011 2:29 PM

Answers

  • >unless there is a possibility bind Visual Studio theme color directly in xaml

    You mean like this?

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

    where vsfx is

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

    Ryan

    • Marked as answer by pingvinius Tuesday, August 30, 2011 8:13 AM
    Monday, August 29, 2011 5:30 PM

All replies

  • Are you in 2008 or 2010?  In 2010 you should be using DynamicResource along with the shell exposed colors, that way you don't need to do anything and will get automatic updates when these things change.

    Ryan

    Monday, August 29, 2011 3:54 PM
  • I know how to use the dynamic resources in WPF, but unless there is a possibility bind Visual Studio theme color directly in xaml? I know only one way to get these colors - a method GetVSSysColorEx.
    My question was: how to know that changed the theme color? Is there an event in Visual Studio Extensibility after changing theme color?
    Monday, August 29, 2011 4:18 PM
  • >unless there is a possibility bind Visual Studio theme color directly in xaml

    You mean like this?

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

    where vsfx is

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

    Ryan

    • Marked as answer by pingvinius Tuesday, August 30, 2011 8:13 AM
    Monday, August 29, 2011 5:30 PM
  • Thank you very much. It helped me a lot!
    Tuesday, August 30, 2011 8:13 AM