1,在xaml内引用项目资源字典
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MyDics/Dic1.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
2,在xaml内引用外部项目资源字典
<ResourceDictionary Source="/mylibrary;component/MyDics/Dic1.xaml"/>
或者
<ResourceDictionary Source="pack://application:,,,/only.PlayerServer;component/MyDics/Dic1.xaml"/>
3,在代码中引用项目资源字典,与引用外部字典方法一致,请参考下一个
4,在代码中引用外部项目资源字典
Resources.MergedDictionaries.Clear();
Resources.MergedDictionaries.Add(
new ResourceDictionary { Source = new Uri($"/mylibrary;component/{langString}/Dic1.xaml", UriKind.RelativeOrAbsolute) }
);
或者
Resources.MergedDictionaries.Clear();
Resources.MergedDictionaries.Add(
new ResourceDictionary { Source = new Uri($"pack://application:,,,/mylibrary;component/{langString}/Dic1.xaml", UriKind.RelativeOrAbsolute) }
);