예제 #1
0
        private static IType GetDesignInstanceType(DocumentCompositeNode designInstanceNode)
        {
            if (designInstanceNode.DocumentRoot == null)
            {
                return((IType)null);
            }
            IType        type      = (IType)null;
            IProperty    property1 = (IProperty)designInstanceNode.Type.GetMember(MemberType.LocalProperty, "Type", MemberAccessTypes.Public);
            DocumentNode dataNode  = designInstanceNode.Properties[(IPropertyId)property1];

            if (dataNode != null)
            {
                IType dataType = DataContextHelper.GetDataType(dataNode);
                if (dataType.RuntimeType == (Type)null)
                {
                    return((IType)null);
                }
                IProperty             property2 = (IProperty)designInstanceNode.Type.GetMember(MemberType.LocalProperty, "CreateList", MemberAccessTypes.Public);
                DocumentPrimitiveNode documentPrimitiveNode1 = designInstanceNode.Properties[(IPropertyId)property2] as DocumentPrimitiveNode;
                bool                  createList             = documentPrimitiveNode1 != null && documentPrimitiveNode1.GetValue <bool>();
                IProperty             property3 = (IProperty)designInstanceNode.Type.GetMember(MemberType.LocalProperty, "IsDesignTimeCreatable", MemberAccessTypes.Public);
                DocumentPrimitiveNode documentPrimitiveNode2 = designInstanceNode.Properties[(IPropertyId)property3] as DocumentPrimitiveNode;
                bool                  isDesignTimeCreatable  = documentPrimitiveNode2 != null && documentPrimitiveNode2.GetValue <bool>();
                DesignTypeResult      typeToInstantiate      = DesignTypeInstanceBuilder.GetTypeToInstantiate(designInstanceNode.PlatformMetadata, dataType.RuntimeType, createList, isDesignTimeCreatable);
                if (typeToInstantiate.IsFailed)
                {
                    return((IType)null);
                }
                type = designInstanceNode.TypeResolver.GetType(typeToInstantiate.DesignType);
            }
            return(type);
        }
예제 #2
0
        private static IType GetCollectionViewSourceType(DocumentCompositeNode collectionViewNode)
        {
            DocumentNode dataNode = collectionViewNode.Properties[DesignTimeProperties.DesignSourceProperty];

            if (dataNode != null)
            {
                return(DataContextHelper.GetDataType(dataNode));
            }
            IPropertyId index = (IPropertyId)PlatformTypes.CollectionViewSource.GetMember(MemberType.LocalProperty, "Source", MemberAccessTypes.Public);

            return(DataContextHelper.GetDataType(collectionViewNode.Properties[index]));
        }
예제 #3
0
        private static IType GetDesignDataType(DocumentCompositeNode designDataNode)
        {
            if (designDataNode.DocumentRoot == null)
            {
                return((IType)null);
            }
            IType         type = (IType)null;
            IDocumentRoot sourceXamlDocument = DesignDataInstanceBuilder.GetSourceXamlDocument(designDataNode);

            if (sourceXamlDocument != null && sourceXamlDocument.RootNode != null)
            {
                type = DataContextHelper.GetDataType(sourceXamlDocument.RootNode);
            }
            return(type);
        }
예제 #4
0
        private static IType GetTypeFromDataSource(RawDataSourceInfoBase dataSource)
        {
            if (!dataSource.IsValid || dataSource.SourceNode == null)
            {
                return((IType)null);
            }
            IType type = DataContextHelper.GetDataType(dataSource.SourceNode);

            if (dataSource.HasClrPath && type != null && type.RuntimeType != (Type)null)
            {
                DataSchemaNodePath nodePathFromPath = new ClrObjectSchema(type.RuntimeType, dataSource.SourceNode).GetNodePathFromPath(dataSource.ClrPath);
                type = nodePathFromPath != null ? nodePathFromPath.Type : (IType)null;
            }
            return(type);
        }
예제 #5
0
        private static IType GetObjectDataProviderType(DocumentCompositeNode objectDataProviderNode)
        {
            DocumentNode dataNode1 = objectDataProviderNode.Properties[ObjectDataProviderSceneNode.ObjectTypeProperty];

            if (dataNode1 != null)
            {
                return(DataContextHelper.GetDataType(dataNode1));
            }
            DocumentNode dataNode2 = objectDataProviderNode.Properties[ObjectDataProviderSceneNode.ObjectInstanceProperty];

            if (dataNode2 != null)
            {
                return(DataContextHelper.GetDataType(dataNode2));
            }
            return((IType)null);
        }
 private bool IsSampleDataTypeNode(DocumentNode compositeNode)
 {
     return(this.SampleData.IsTypeOwner(DataContextHelper.GetDataType(compositeNode)));
 }