Ejemplo n.º 1
0
 public static T?TryGet <T>(this UI.Xaml.ResourceDictionary?resources, string key)
 {
     if (resources?.ContainsKey(key) == true && resources[key] is T typed)
     {
         return(typed);
     }
     return(default);
Ejemplo n.º 2
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)
                });
            }
        }