public static IElementFactory FromXamlElement(XamlElement element, Type targetType) { Type elementType = element.GetElementType(); if (element.Values.Any() && ContentPropertyAttribute.GetPropertyName(elementType).IsNullOrEmpty() && !ElementCollectionContentInitailizer.IsCollectionType(elementType)) { return(FromElementFactory(FromXamlElementContent(element), targetType, element.Namespaces, element.SourceUri)); } IElementInitializer elementInitializer = new ElementInitializer(element); IElementFactory elementFactory = new ElementFactory(elementType, elementInitializer); return(FromElementFactory(elementFactory, targetType, element.Namespaces, element.SourceUri)); }
public static IElementFactory FromXamlElement(XamlElement element, Type targetType) { Type elementType = element.GetElementType(); if (elementType.GetDefaultConstructor() == null) { return(FromElementFactory(FromXamlElementContent(element), targetType, element.Namespaces)); } IElementInitializer elementInitializer = new ElementInitializer(element); IElementFactory elementFactory = new ElementFactory(elementType, elementInitializer); return(FromElementFactory(elementFactory, targetType, element.Namespaces)); }
public static void Load(object target, XamlElement resource) { IElementInitializer initializer = new ElementInitializer(resource); initializer.InitializeElement(target, new InitializeContext()); }
public static IElementFactory FromXamlElement(XamlElement element, Type targetType) { Type elementType = element.GetElementType(); if (elementType.GetDefaultConstructor() == null) { return FromElementFactory(FromXamlElementContent(element), targetType, element.Namespaces); } IElementInitializer elementInitializer = new ElementInitializer(element); IElementFactory elementFactory = new ElementFactory(elementType, elementInitializer); return FromElementFactory(elementFactory, targetType, element.Namespaces); }