[英]WPF Resource Dictionary Build Action
I have a ResourceDictionary
in a xaml
file called SylesResourceDictionary.xaml in a Class Library
Project. 我在
Class Library
项目的名为SylesResourceDictionary.xaml的xaml
文件中有一个ResourceDictionary
。 This ResourceDictionary
is used in different views by Merging. 通过合并,此
ResourceDictionary
在不同的视图中使用。
I'm new to ResourceDictionary
and not sure if I'm doing it the right way. 我是
ResourceDictionary
新手,不确定是否以正确的方式进行操作。 Different article suggest different Build Action Like Page
and Custom Tool Like XamlIntelliSenseFileGenerator
不同的文章建议不同的构建操作(如
Page
和自定义工具(如XamlIntelliSenseFileGenerator
What should be the Build Action
for this xaml file ? 此xaml文件的
Build Action
应该是什么? I have it set to Resource 我将其设置为资源
What should be the Custom Tool
? 什么是
Custom Tool
? I have it set to MSBuildCompile 我将其设置为MSBuildCompile
Should I delete the xaml.cs
file for this xaml file ? 我应该删除该xaml文件的
xaml.cs
文件吗?
ResourceDictionary
should be set to Page
. ResourceDictionary
的构建操作应设置为Page
。 XamlIntelliSenseFileGenerator
. XamlIntelliSenseFileGenerator
。 Only the XAML compiler knows how to compile the XAML file to BAML. ResourceDictionary
may have a code-behind file but by default it's XAML only. ResourceDictionary
可能有一个代码隐藏文件,但默认情况下仅是XAML。 You may also want to consider creating a project using either the WPF Custom Control Library
template or the WPF User Control Libary
template instead of using the Class Library
template. 您可能还需要考虑使用
WPF Custom Control Library
模板或WPF User Control Libary
模板而不是Class Library
模板来创建项目。 This will make it easier working with WPF and XAML specific types in Visual Studio. 这将使在Visual Studio中使用WPF和XAML特定类型更加容易。 You will still be able to add any other types to the project as well.
您仍然可以将任何其他类型添加到项目中。
In general: 一般来说:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.