Exemplo n.º 1
0
 internal static void RemoveKeys(this UI.Xaml.ResourceDictionary resources, IEnumerable <string> keys)
 {
     foreach (string key in keys)
     {
         resources.Remove(key);
     }
 }
Exemplo n.º 2
0
 internal static void SetValueForAllKey(this UI.Xaml.ResourceDictionary resources, IEnumerable <string> keys, object value)
 {
     foreach (string key in keys)
     {
         resources[key] = value;
     }
 }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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)
                });
            }
        }