using System; using System.Reflection; using System.Windows; namespace K.Controls.Controls.Helper { public class ResourceHelper { private static ResourceDictionary _theme; internal static T GetResourceInternal<T>(string key) { if (GetTheme()[key] is T resource) { return resource; } return default; } public static ResourceDictionary GetTheme() => _theme == null ? GetStandaloneTheme() : _theme; public static ResourceDictionary GetStandaloneTheme() { return new ResourceDictionary() {Source = new Uri("pack://application:,,,/K.Controls;component/Styles/UserStyle.xaml") }; } public static string GetImageIconByType() { var imageIcon1 = string.Empty; imageIcon1 = Application.Current.Resources[$"{name}" + "LoginIcon"].ToString(); //imageIcon1 = "/K.Controls;component/Images/Black/1.png";
return imageIcon1; }
}
}
标签:文件,imageIcon1,return,ResourceDictionary,Controls,获取,static,WPF,public From: https://www.cnblogs.com/jnyyq/p/17688416.html