<Page Include="Properties\DesignTimeResources.xaml" Condition="'$(DesignTime)'=='true' OR ('$(SolutionPath)'!='' AND Exists('$(SolutionPath)') AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true')">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<ContainsDesignTimeResources>true</ContainsDesignTimeResources>
</Page>
前缀来包含您的设计时资源:
d:
旁注:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<d:ResourceDictionary Source="/OTHER_ASSEMBLY;component/Resource/YOUR_DESIGN_TIME_RESOURCE.xaml" />
<ResourceDictionary Source="/styles/YOUR_COMPILED_RESOURCE.xaml" />
<ResourceDictionary Source="/OTHER_ASSEMBLY;component/styles/YOUR_COMPILED_RESOURCE2.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
还可以用于设置 Control 上的设计时属性,例如
d:
,尽管它未在 IntelliSense 中列出...ps:我确认它可以在最新的 VS 2022 上运行,我不确定它是否可以在较低版本上运行。