对其他控件造成问题的资源字典
本文关键字:资源 字典 成问题 其他 控件 | 更新日期: 2023-09-27 18:05:27
我有两个资源字典,并试图添加
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Skins/MainSkin.xaml"/>
<ResourceDictionary Source="/Skins/Expander.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
如果我尝试在资源中添加转换器,那么它将找不到字典。
如果你有这个:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Skins/MainSkin.xaml"/>
<ResourceDictionary Source="/Skins/Expander.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
然后将特定的ResourceDictionary分配给UserControl。资源属性。如果您想在合并的字典之外添加额外的资源,您必须将它们添加到ResourceDictionary中,如下所示:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Skins/MainSkin.xaml"/>
<ResourceDictionary Source="/Skins/Expander.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- TODO: Add items here -->
</ResourceDictionary>
<!-- NOTE: You can't add items here -->
</UserControl.Resources>