我想合并后面的代码wpf资源字典,但对于一些reasion这是行不通的。如果我尝试合并在它的运行,例如文档本身的字典:合并资源字典
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication212;assembly=WpfApplication212">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Theme.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type local:URComboBox}" BasedOn="{StaticResource ComboBoxStyle}">
</Style>
这是工作,但如果我评论的ResourceDictionary.MergedDictionaries和代码试试这个:
ResourceDictionary skin = new ResourceDictionary();
skin.Source = styleLocation;
ResourceDictionary skinFather = new ResourceDictionary();
skinFather.MergedDictionaries.Add(skin);
skinFather.Source = styleLocationFather;
由于无法找到资源,因此会中断。
什么是 “styleLocation” 和 “styleLocationFather”? – 2010-04-12 15:39:41