internal static void RemoveKeys(this UI.Xaml.ResourceDictionary resources, IEnumerable <string> keys) { foreach (string key in keys) { resources.Remove(key); } }
internal static void SetValueForAllKey(this UI.Xaml.ResourceDictionary resources, IEnumerable <string> keys, object value) { foreach (string key in keys) { resources[key] = value; } }
public static void AddLibraryResources <T>(this UI.Xaml.ResourceDictionary resources) where T : UI.Xaml.ResourceDictionary, new() { var dictionaries = resources?.MergedDictionaries; if (dictionaries == null) { return; } var found = false; foreach (var dic in dictionaries) { if (dic is T) { found = true; break; } } if (!found) { var dic = new T(); dictionaries.Add(dic); } }
internal static UI.Xaml.ResourceDictionary GetTabletResources() { var dict = new UI.Xaml.ResourceDictionary { Source = new Uri("ms-appx:///Microsoft.Maui.Controls.Compatibility/WinUI/Resources.xbf") }; return(dict); }
public static void AddLibraryResources(this UI.Xaml.ResourceDictionary resources, string key, string uri) { if (resources == null) { return; } var dictionaries = resources.MergedDictionaries; if (dictionaries == null) { return; } if (!resources.ContainsKey(key)) { dictionaries.Add(new UI.Xaml.ResourceDictionary { Source = new Uri(uri) }); } }