VS2010 到 VS2012 ToolWindow XAML 参考 VsBrushes

VS2010 到 VS2012 ToolWindow XAML 参考 VsBrushes

问题描述:

所以我想我会在那里运行它,看看我是否遗漏了一些愚蠢的东西.

So I thought I'd run this out there, and see if I was missing something idiotic.

我开发了一个仅用于我的小型 VSIX 扩展,并且在我的一个工具窗口中,我使用代码来设置前景色/背景色:

I developed a small my-use-only VSIX extension, and in one of my toolwindows, I'm using the code to set the foreground/background color:

    Foreground="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowTextKey}}"
    Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolboxBackgroundKey}}"

vsfx: 命名空间被引用为:

The vsfx: namespace is referenced as:

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

我看到那里引用了 10.0,对我来说,这是预期的,因为我最初是在 VS2010 中这样做的.现在我的工作使我升级到 VS2012,XAML 设计器在这两个 SynamicResources 上给了我以下错误.错误内容为 '资源 {x:Static vsfx:VsBrushes.ToolWindowTextKey} 无法解析.' 和第二个类似.

I see the 10.0 referenced there, and for me, that's expected as I originally did this up in VS2010. Now that my work has made me upgrade to VS2012, the XAML designer is giving me the following error on those two SynamicResources. The error reads 'The resource {x:Static vsfx:VsBrushes.ToolWindowTextKey} could not be resolved.' and like for the second one.

现在,请注意该项目仍在构建和运行,并且可以加载到 VS2012 中.但是,颜色全部关闭(标准,与 VS 设置的主题不匹配.)

Now, note that the project still builds and runs, and can be loaded into VS2012. However, the colors are all off (standard, don't match the theme that VS is set to.)

对检查或寻找什么有任何想法吗?

Any thoughts on what to check or look for?

干杯 -迈克.

我遇到了和你们一样的问题,并发现了以下事实:

I ran into the same question as you guys do, and found out the follow facts:

[VsBrushes/VsBrush] vs.[环境颜色]:

  1. VsBrushes 和 VsBrush 基本相同,在 VS2010/2012/2013 中支持;
  2. EnviornmentColors 仅在 VS2012/2013 中可用,在 VS2010 中不支持;
  3. EnvironmentColors 仍在开发中,新主题将添加更多颜色;VsBrushes/VsBrush 是相对静态的.

[VsBrushes] vs.[VsBrush]:

  1. VsBrushes"的好处在于它会检查构建过程中是否存在特定的颜色名称.
  2. VsBrushes"的缺点是必须在 XAML 文件头中指定 VS 命名空间和程序集版本,这很不方便.(例如 xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0")

谢谢.