public static void AddTypeDateTemplate <ForType>(this IServiceProvider serviceProvider, string resourceDictionaryLocation)
        {
            var rd = ResourceDictionaryUtilities.Get(resourceDictionaryLocation, typeof(ForType).Assembly);

            foreach (var possibleKey in GetPossibleKeys <ForType>())
            {
                if (rd.Contains(possibleKey))
                {
                    serviceProvider.GetRequiredService <ITypeDataTemplateManager>().Add(typeof(ForType), (DataTemplate)rd[possibleKey]);
                    return;
                }
            }
            foreach (var item in rd.Values.OfType <DataTemplate>())
            {
                if (item.DataType is Type dt && dt == typeof(ForType))
                {
                    serviceProvider.GetRequiredService <ITypeDataTemplateManager>().Add(typeof(ForType), item);
                    return;
                }
            }
            throw new KeyNotFoundException($"Cannot find a {nameof(DataTemplate)} for {typeof(ForType).Name} inside {resourceDictionaryLocation}");
        }
 public static void AddTypeDateTemplate <ForType>(this IServiceProvider serviceProvider, string resourceDictionaryLocation, object templateKey)
 {
     serviceProvider.GetRequiredService <ITypeDataTemplateManager>().Add(typeof(ForType), (DataTemplate)
                                                                         ResourceDictionaryUtilities.Get(resourceDictionaryLocation, typeof(ForType).Assembly)
                                                                         [templateKey]);
 }