直接上代码
public void ChangeColorStyle() { ResourceDictionary resource=new ResourceDictionary(); for(int i=0;i<Appliation.Current.Resources.MegedDictionaries.Count;i++) { if(Appliation.Current.Resources.MegedDictionaries[i].Source!=null)
{
if(Appliation.Current.Resources.MegedDictionaries[i].Source.ToString().Contains("Theme.xaml"))
{
resource.Source=new Uri("pack://application:,,,/;Component/Themes/MainTheme.xaml");
Appliation.Current.Resources.MegedDictionaries[i]=resource;
return;
}
}
}
}
标签:resource,Current,Source,切换,配色,new,WPF,Resources From: https://www.cnblogs.com/follow-discoverer/p/17375525.html