public static void Initialize(IEnumerable <Assembly> resourceSearchAssemblies) { if (initialized) { return; } var dependencyPropertyService = new DependencyPropertyService(); var markupExtensionParser = new MarkupExtensionParser(); var cssTypeHelper = new CssTypeHelper <DependencyObject, DependencyObject, DependencyProperty, Style>(markupExtensionParser, dependencyPropertyService); instance = new BaseCss <DependencyObject, DependencyObject, Style, DependencyProperty>( dependencyPropertyService, new LogicalTreeNodeProvider(dependencyPropertyService), new StyleResourceService(), new StyleService(dependencyPropertyService), DomElementBase <DependencyObject, DependencyProperty> .GetPrefix(typeof(Button)), markupExtensionParser, RunOnUIThread, new CssFileProvider(resourceSearchAssemblies, cssTypeHelper) ); LoadedDetectionHelper.Initialize(); LoadedDetectionHelper.SubTreeAdded += LoadedDetectionHelper_SubTreeAdded; LoadedDetectionHelper.SubTreeRemoved += LoadedDetectionHelper_SubTreeRemoved; CompositionTarget.Rendering += RenderingHandler; initialized = true; }
public static void Initialize(IEnumerable <Assembly> resourceSearchAssemblies, IDictionary <string, List <string> > cssNamespaceMapping = null) { if (initialized) { return; } cssNamespaceMapping = cssNamespaceMapping ?? DefaultCssNamespaceMapping; TypeHelpers.Initialze(cssNamespaceMapping, false); var defaultCssNamespace = cssNamespaceMapping.Keys.First(); var dependencyPropertyService = new DependencyPropertyService(); var markupExtensionParser = new MarkupExtensionParser(); var cssTypeHelper = new CssTypeHelper <DependencyObject, DependencyProperty, Style>(markupExtensionParser, dependencyPropertyService); instance = new BaseCss <DependencyObject, Style, DependencyProperty>( dependencyPropertyService, new TreeNodeProvider(dependencyPropertyService), new StyleResourceService(), new StyleService(dependencyPropertyService), defaultCssNamespace, markupExtensionParser, RunOnUIThread, new CssFileProvider(resourceSearchAssemblies, cssTypeHelper) ); LoadedDetectionHelper.Initialize(); CompositionTarget.Rendering += RenderingHandler; initialized = true; }
public static void Initialize(IEnumerable <Assembly> resourceSearchAssemblies) { if (initialized) { return; } var mapping = new Dictionary <string, List <string> > { { "http://schemas.microsoft.com/winfx/2006/xaml/presentation", new List <string> { typeof(Windows.UI.Xaml.Data.Binding).AssemblyQualifiedName.Replace(".Binding,", ","), typeof(Windows.UI.Xaml.Shapes.Rectangle).AssemblyQualifiedName.Replace(".Rectangle,", ","), typeof(Windows.UI.Xaml.Controls.Button).AssemblyQualifiedName.Replace(".Button,", ","), typeof(Windows.UI.Xaml.FrameworkElement).AssemblyQualifiedName.Replace(".FrameworkElement,", ","), typeof(Windows.UI.Xaml.Documents.Run).AssemblyQualifiedName.Replace(".Run,", ",") } } }; TypeHelpers.Initialze(mapping, false); var dependencyPropertyService = new DependencyPropertyService(); var markupExtensionParser = new MarkupExtensionParser(); var cssTypeHelper = new CssTypeHelper <DependencyObject, DependencyProperty, Style>(markupExtensionParser, dependencyPropertyService); instance = new BaseCss <DependencyObject, Style, DependencyProperty>( dependencyPropertyService, new LogicalTreeNodeProvider(dependencyPropertyService), new StyleResourceService(), new StyleService(dependencyPropertyService), DomElementBase <DependencyObject, DependencyProperty> .GetAssemblyQualifiedNamespaceName(typeof(Button)), markupExtensionParser, RunOnUIThread, new CssFileProvider(resourceSearchAssemblies, cssTypeHelper) ); LoadedDetectionHelper.Initialize(); CompositionTarget.Rendering += RenderingHandler; initialized = true; }