我在Windows Phone项目中获得了generic.xaml文件,而且它太大了。如何将generic.xaml划分为多个文件?
我知道<ResourceDictionary.MergedDictionaries>
但是,我无法使其发挥作用。项目编译,但当Page试图解析xaml资源时,我得到了运行时异常。
我试过:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="WatermarkedPinBox.xaml"/>
</ResourceDictionary.MergedDictionaries>
请帮帮我,我不喜欢大资源文件。很难保持他们的结构良好状态。
答案 0 :(得分:-1)
您可以使用MergedDictionaries
拆分Generic.xaml
文件。看看这个例子:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mscorlib="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/YourProjectName;component/Themes/YourSecondResourceFileName.xaml" />
<ResourceDictionary Source="/YourProjectName;component/Themes/YourThirdResourceFileName.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
YourSecondResourceFileName.xaml的 Build Action
和YourThirdResourceFileName.xaml必须设置为Page
。