예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
파일: XamlLoader.cs 프로젝트: Ref12/Grazor
        public static void Load(object target, XamlElement resource)
        {
            IElementInitializer initializer = new ElementInitializer(resource);

            initializer.InitializeElement(target, new InitializeContext());
        }
예제 #4
0
        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);
        }
예제 #5
0
 public static void Load(object target, XamlElement resource)
 {
     IElementInitializer initializer = new ElementInitializer(resource);
     initializer.InitializeElement(target, new InitializeContext());
 }