【问题标题】:How can I find out when Visual Studio theme color changes?如何知道 Visual Studio 主题颜色何时发生变化?
【发布时间】:2011-08-29 14:03:19
【问题描述】:

我使用工具窗口开发 Visual Studio 包。工具窗口的 UI 基于 WPF。 在我的用户控件中,我想使用与 VS 设计相对应的当前 Visual Studio 主题颜色。

因此,我的问题是如何发现 Visual Studio 主题颜色已更改?

提前致谢。

【问题讨论】:

    标签: c# wpf visual-studio-extensions


    【解决方案1】:

    我找到了另一种方法。我可以直接使用来自 xaml 的 Visual Studio 主题颜色资源。 例如:

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

    vsfx 在哪里

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

    这种方法解决了这个问题!

    【讨论】:

      【解决方案2】:

      如果要检测主题变化事件本身,可以使用VSColorTheme.ThemeChanged静态事件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-05-17
        • 2012-08-20
        • 2013-09-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多