Theming using resources without Blend vomitting

一笑奈何 提交于 2019-12-06 01:43:37

So I haven't tried this, but it sounds like it would work. Also, the information is a bit dated. Please do let me know if it solves the problem. :)

From the Blend blog, add the following two chunks to your project files:

<DesignTime Condition="'$(SolutionPath)'!='' AND Exists('$(SolutionPath)')">true</DesignTime>

…. 
<ApplicationDefinition Condition="'$(DesignTime)'=='true' AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true'" Include="App.xaml"> 
      <Generator>MSBuild:Compile</Generator> 
      <SubType>Designer</SubType> 
</ApplicationDefinition>

Basically this includes your app.xaml conditionally into your project so it gets used at design time, but not at build time. I'm guessing they assume people use msbuild to produce production code rather than clicking the build compile button.

Seems like this bug disappears if you use DynamicResources instead.

Explained here in b): http://blogs.msdn.com/b/unnir/archive/2009/03/31/blend-wpf-and-resource-references.aspx

Someone posted this link in an earlier SO question on the same bug, but for some reason it got no upvotes and was lost below other answers.

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