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);
不工作....