WPF 后台读取样式文件

原文: WPF 后台读取样式文件

ResourceDictionary dic = new ResourceDictionary { Source = new Uri("Styles.xaml",UriKind.Relative) };
Style style = (Style)dic["TextBlockStyle"];
ResourceDictionary dic0 = (ResourceDictionary)System.Windows.Application.LoadComponent(new Uri("Styles.xaml", UriKind.RelativeOrAbsolute));
Style style0 = (Style)dic0["TextBlockStyle"];

猜你喜欢

转载自www.cnblogs.com/lonelyxmas/p/10789525.html