Example #1
0
        static SettingsViewLocator()
        {
            var templates = PluginCatalog
                            .PluginTypes()
                            .Where(type =>
            {
                var name = type.Name;
                return
                (type.IsClass &&
                 !type.IsAbstract &&
                 typeof(ElementSettingsDataTemplate).IsAssignableFrom(type) &&
                 (type.GetGenericTypeImplementation(typeof(ElementSettingsDataTemplate <>)) != null) &&
                 type != typeof(FallbackDataTemplate));
            });

            SettingsViewLocator.RegisterTemplate(new FallbackDataTemplate(), Priority.FALLBACK);
            foreach (var templateType in templates)
            {
                SettingsViewLocator.RegisterTemplate((IDataTemplate)Activator.CreateInstance(templateType));
            }
        }