WPF 通过代码添加资源
////// 添加资源到程序环境中 /// /Library.Name;component/Themes/{0}Theme.xaml /// /// 资源路径 public static void UpdateResource(string path) { var uri = new Uri(path, UriKind.Relative); ResourceDictionary resources = (ResourceDictionary)Application.LoadComponent(uri); Application.Current.Resources.MergedDictionaries.Add(resources); }