0
我想添加字符串与风格加入到资源字典,这怎么可能如何与样式添加字符串添加到资源字典在WPF
Ex : string MyStyle = "<Style x:Key='baseStyle' TargetType='{x:Type Button}'>" +
"<Setter Property='FontSize' Value='12' />" +
"<Setter Property='Background' Value='Orange' /></Style>";
我想这个字符串添加到ResourceDictionary中
如何?
ResourceDictionary rd = new ResourceDictionary();
rd.MergedDictionaries.Clear();
rd.Add("MyStyle", MyStyle);
Application.Current.Resources.MergedDictionaries.Add(rd);
不工作....