public RawDataSourceInfoBase GetRawDataContextInfo(DocumentCompositeNode documentNode) { if (documentNode == null) { return((RawDataSourceInfoBase)null); } IProperty ptoperty = DesignTimeProperties.ResolveDesignTimePropertyKey(DesignTimeProperties.DesignDataContextProperty, documentNode.PlatformMetadata); DocumentNode dataSourceNode = documentNode.Properties[(IPropertyId)ptoperty]; if (dataSourceNode == null) { ptoperty = DataContextHelper.GetDataContextProperty(documentNode.Type); if (ptoperty != null) { dataSourceNode = documentNode.Properties[(IPropertyId)ptoperty]; } } if (dataSourceNode == null) { return((RawDataSourceInfoBase)null); } RawDataSourceInfoBase rawDataSourceInfo = DataContextHelper.GetRawDataSourceInfo(dataSourceNode); if (rawDataSourceInfo != null && rawDataSourceInfo.IsValid) { this.OnDataSourceFound(documentNode, ptoperty); } return(rawDataSourceInfo); }
private void ProcessPotentialDataContextOwner(DocumentNode documentNode, bool needDesignTimeProperty) { IProperty dataContextProperty = DataContextHelper.GetDataContextProperty(documentNode.Type, needDesignTimeProperty); if (dataContextProperty == null) { return; } DocumentCompositeNode documentCompositeNode1 = documentNode as DocumentCompositeNode; if (documentCompositeNode1 == null) { return; } DocumentCompositeNode documentCompositeNode2 = documentCompositeNode1.Properties[(IPropertyId)dataContextProperty] as DocumentCompositeNode; if (documentCompositeNode2 == null) { return; } RawDataSourceInfoBase rawDataSourceInfo = DataContextHelper.GetRawDataSourceInfo((DocumentNode)documentCompositeNode2); if (!rawDataSourceInfo.HasSource || !rawDataSourceInfo.IsValidClr || !this.SampleData.IsTypeOwner(rawDataSourceInfo.SourceType)) { return; } this.documentNodesToModify.Add(documentCompositeNode1); }
public static RawDataSourceInfoBase GetDataSourceInfoFromBinding(DocumentCompositeNode bindingNode) { RawDataSourceInfoBase dataSourceInfoBase = (RawDataSourceInfoBase)null; DocumentCompositeNode resourceReferenceNode = bindingNode.Properties[BindingSceneNode.SourceProperty] as DocumentCompositeNode; if (resourceReferenceNode == null) { dataSourceInfoBase = (RawDataSourceInfoBase)DataContextHelper.GetElementNameBinding(bindingNode); } if (dataSourceInfoBase == null) { string bindingPath = DataContextHelper.GetBindingPath(bindingNode); if (resourceReferenceNode != null && resourceReferenceNode.Type.IsResource) { dataSourceInfoBase = DataContextHelper.GetDataSourceInfoFromResourceReference(resourceReferenceNode); if (!dataSourceInfoBase.IsValid) { return(dataSourceInfoBase); } dataSourceInfoBase.AppendClrPath(bindingPath); } else { dataSourceInfoBase = (RawDataSourceInfoBase) new RawDataSourceInfo((DocumentNode)resourceReferenceNode, bindingPath); } } string bindingXpath = DataContextHelper.GetBindingXPath(bindingNode); dataSourceInfoBase.XmlPath = XmlSchema.CombineXPaths(dataSourceInfoBase.XmlPath, bindingXpath); if (bindingNode.Properties[BindingSceneNode.RelativeSourceProperty] != null) { dataSourceInfoBase.SetInvalid(); } return(dataSourceInfoBase); }
private RawDataSourceInfoBase InitDataContext(DataBindingProcessingContext context) { if (PlatformTypes.ResourceDictionary.IsAssignableFrom((ITypeId)context.DocumentNode.Type)) { return((RawDataSourceInfoBase)RawDataSourceInfo.NewEmpty); } if (DataContextHelper.IsDataContextProperty((DocumentNode)context.ParentNode, (IPropertyId)context.Property)) { return(context.GrandparentDataContext); } DataBindingProcessor.DataContextWalker dataContextWalker = new DataBindingProcessor.DataContextWalker(context.ParentContext, context.Property, this.namedElementDataContexts); RawDataSourceInfoBase localDataContext = this.DataContextEvaluator.NavigateSpecialDataContext((IDataContextAncestorWalker)dataContextWalker, (RawDataSourceInfoBase)null); if (localDataContext == null) { RawDataSourceInfoBase rawDataContextInfo = this.DataContextEvaluator.GetRawDataContextInfo(context.DocumentCompositeNode); localDataContext = this.DataContextEvaluator.UnwindElementNameBinding((IDataContextAncestorWalker)dataContextWalker, rawDataContextInfo); } this.DataContextEvaluator.MoveUpIfDataContextLocation((IDataContextAncestorWalker)dataContextWalker); if (localDataContext is ElementDataSourceInfo) { return(localDataContext); } if (dataContextWalker.CurrentContext != null) { localDataContext = this.CombineDataSources(dataContextWalker.CurrentContext.DataContext, localDataContext); } if (localDataContext == null) { localDataContext = (RawDataSourceInfoBase)RawDataSourceInfo.NewEmpty; } return(localDataContext); }
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); }
private RawDataSourceInfoBase GetRelativeSourceTargetBindingDataSource(DataBindingProcessingContext context) { if (context.OuterContext == null || !context.IsStyleOrControlTemplateScope) { return((RawDataSourceInfoBase)null); } string bindingRelativeSource = this.GetBindingRelativeSource(context); if (string.IsNullOrEmpty(bindingRelativeSource)) { return((RawDataSourceInfoBase)null); } DataBindingProcessingContext context1 = (DataBindingProcessingContext)null; if (context.Scope == ProcessingContextScope.Style && bindingRelativeSource == "Self") { if (context.OuterContext != null) { context1 = context.OuterContext.ParentContext; } } else if (context.Scope == ProcessingContextScope.ControlTemplate && bindingRelativeSource == "TemplatedParent") { context1 = this.GetTemplatedParentContext(context); } if (context1 == null || PlatformTypes.DictionaryEntry.IsAssignableFrom((ITypeId)context1.DocumentNode.Type)) { return((RawDataSourceInfoBase)null); } string bindingPath = DataContextHelper.GetBindingPath(context.DocumentCompositeNode); if (string.IsNullOrEmpty(bindingPath)) { return((RawDataSourceInfoBase)null); } IList <ClrPathPart> parts = ClrPropertyPathHelper.SplitPath(bindingPath); if (parts == null || parts.Count == 0) { return((RawDataSourceInfoBase)null); } ClrPathPart clrPathPart = parts[0]; if (clrPathPart.Category != ClrPathPartCategory.PropertyName) { return((RawDataSourceInfoBase)null); } RawDataSourceInfoBase sourceFromProperty = this.GetDataSourceFromProperty(context1, clrPathPart.Path); if (sourceFromProperty == null || !sourceFromProperty.IsValid) { return((RawDataSourceInfoBase)null); } string path = ClrPropertyPathHelper.CombinePathParts(parts, 1); sourceFromProperty.AppendClrPath(path); return(sourceFromProperty); }
private void ApplyChanges(SceneDocument sceneDocument) { List <DocumentCompositeNode> list = new List <DocumentCompositeNode>(); for (int index = this.documentNodesToModify.Count - 1; index >= 0; --index) { DocumentCompositeNode documentCompositeNode = this.documentNodesToModify[index]; if (documentCompositeNode.DocumentRoot == this.CurrentDocument.DocumentRoot) { list.Add(documentCompositeNode); this.documentNodesToModify.RemoveAt(index); } } if (this.IsKilled || list.Count == 0) { return; } SceneView sceneView = this.GetSceneView(sceneDocument); string description = string.Format((IFormatProvider)CultureInfo.CurrentCulture, this.SampleData.IsEnabledAtRuntime ? StringTable.SampleDataEnableTransaction : StringTable.SampleDataDisableTransaction, new object[1] { (object)this.SampleData.Name }); using (SceneEditTransaction editTransaction = sceneDocument.CreateEditTransaction(description)) { using (sceneView.ViewModel.AnimationEditor.DeferKeyFraming()) { foreach (DocumentCompositeNode documentCompositeNode in list) { IProperty dataContextProperty = DataContextHelper.GetDataContextProperty(documentCompositeNode.Type); IProperty property = DesignTimeProperties.ResolveDesignTimePropertyKey(DesignTimeProperties.DesignDataContextProperty, documentCompositeNode.PlatformMetadata); DocumentNode documentNode1 = documentCompositeNode.Properties[(IPropertyId)dataContextProperty]; DocumentNode documentNode2 = documentCompositeNode.Properties[(IPropertyId)property]; SceneNode sceneNode = sceneView.ViewModel.GetSceneNode((DocumentNode)documentCompositeNode); if (documentNode2 == null) { sceneNode.ClearValue((IPropertyId)dataContextProperty); } else { sceneNode.SetValue((IPropertyId)dataContextProperty, (object)documentNode2); } if (documentNode1 == null) { sceneNode.ClearValue((IPropertyId)property); } else { sceneNode.SetValue((IPropertyId)property, (object)documentNode1); } } editTransaction.Commit(); } } }
private RawDataSourceInfoBase GetBindingAsDataSource(DataBindingProcessingContext context) { RawDataSourceInfoBase sourceInfoFromBinding = DataContextHelper.GetDataSourceInfoFromBinding(context.DocumentCompositeNode); RawDataSourceInfoBase dataSourceInfoBase = this.CombineDataSources(context.DataContext, sourceInfoFromBinding); if (!dataSourceInfoBase.IsValid) { dataSourceInfoBase = this.GetRelativeSourceTargetBindingDataSource(context); } return(dataSourceInfoBase); }
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])); }
public MiniTargetBindingDialogModel(DataSchemaNodePath bindingPath, SceneNode targetElement, ReferenceStep targetProperty, bool useDesignDataContext) : base(bindingPath, targetElement, targetProperty) { this.useDesignDataContext = useDesignDataContext; this.targetBindableProperties = BindingPropertyHelper.GetBindableTargetProperties(this.TargetElement); IProperty dataContextProperty = DataContextHelper.GetDataContextProperty(this.TargetElement.Type); if (dataContextProperty != null && !this.TargetElement.ViewModel.BindingEditor.CanCreateAndSetBindingOrData(targetElement, (IPropertyId)dataContextProperty, bindingPath, true)) { this.targetBindableProperties.Remove((ReferenceStep)dataContextProperty); } this.Initialize(); }
public static IType GetDataType(DocumentNode dataNode) { if (dataNode == null) { return((IType)null); } IType type1 = dataNode.Type; IType type2; if (dataNode is DocumentPrimitiveNode) { type2 = DocumentPrimitiveNode.GetValueAsType(dataNode) ?? dataNode.Type; } else { DocumentCompositeNode documentCompositeNode = (DocumentCompositeNode)dataNode; if (PlatformTypes.ObjectDataProvider.IsAssignableFrom((ITypeId)dataNode.Type)) { type2 = DataContextHelper.GetObjectDataProviderType(documentCompositeNode); } else if (PlatformTypes.CollectionViewSource.IsAssignableFrom((ITypeId)dataNode.Type)) { type2 = DataContextHelper.GetCollectionViewSourceType(documentCompositeNode); } else if (dataNode.Type.IsBinding) { type2 = DataContextHelper.GetBindingType(documentCompositeNode); } else if (dataNode.Type.RuntimeType == typeof(DesignInstanceExtension)) { type2 = DataContextHelper.GetDesignInstanceType(documentCompositeNode); } else if (dataNode.Type.RuntimeType == typeof(DesignDataExtension)) { type2 = DataContextHelper.GetDesignDataType(documentCompositeNode); } else { if (!PlatformTypes.DataTemplate.IsAssignableFrom((ITypeId)dataNode.Type)) { return(dataNode.Type); } type2 = DataContextHelper.GetDataTemplateType(documentCompositeNode); } if (type2 == null || type2.RuntimeType == (Type)null) { type2 = dataNode.TypeResolver.ResolveType(PlatformTypes.Object); } } return(type2); }
public static IProperty GetDataContextProperty(IType type, bool needDesignDataContextProperty) { IProperty property = DataContextHelper.GetDataContextProperty(type); if (property == null) { return((IProperty)null); } if (needDesignDataContextProperty) { property = DesignTimeProperties.ResolveDesignTimePropertyKey(DesignTimeProperties.DesignDataContextProperty, type.PlatformMetadata); } return(property); }
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); }
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); }
public static bool IsDataContextProperty(DocumentNode documentNode, IPropertyId property) { if (property != null && documentNode != null) { if (property.MemberType == MemberType.DesignTimeProperty) { return(DesignTimeProperties.DesignDataContextProperty.Equals((object)property)); } IProperty dataContextProperty = DataContextHelper.GetDataContextProperty(documentNode.Type); if (dataContextProperty != null && dataContextProperty.Equals((object)property)) { return(true); } } return(false); }
private RawDataSourceInfoBase GetDataSourceFromProperty(DataBindingProcessingContext context, IProperty property) { if (DataContextHelper.GetDataContextProperty(context.DocumentNode.Type) == property) { return(context.DataContext); } DocumentNode dataSourceNode = context.DocumentCompositeNode.Properties[(IPropertyId)property]; if (dataSourceNode == null) { return((RawDataSourceInfoBase)null); } RawDataSourceInfoBase rawDataSourceInfo = DataContextHelper.GetRawDataSourceInfo(dataSourceNode); return(this.CombineDataSources(context.DataContext, rawDataSourceInfo)); }
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); }
public static BindingModeInfo GetDefaultBindingMode(DocumentNode targetNode, IPropertyId targetProperty, DataSchemaNodePath schemaPath) { BindingMode mode = (BindingMode)targetNode.TypeResolver.GetCapabilityValue(PlatformCapability.DefaultBindingMode); BindingDirection bindingDirection = (BindingDirection)targetNode.TypeResolver.GetCapabilityValue(PlatformCapability.DefaultBindingDirection); DependencyPropertyReferenceStep propertyReferenceStep = targetNode.TypeResolver.ResolveProperty(targetProperty) as DependencyPropertyReferenceStep; bool flag = false; if (schemaPath != null) { if (schemaPath.Node.IsReadOnly) { flag = true; } else if (schemaPath.Node == schemaPath.Schema.Root) { flag = !DataContextHelper.IsDataContextProperty(targetNode, (IPropertyId)propertyReferenceStep); } } if (flag) { if (mode == BindingMode.Default && bindingDirection == BindingDirection.TwoWay && (propertyReferenceStep != null && propertyReferenceStep.BindsTwoWayByDefault(targetNode.Type.RuntimeType))) { return(new BindingModeInfo(BindingMode.OneWay, false)); } if (schemaPath.IsCollection) { return(new BindingModeInfo(mode, true)); } return(new BindingModeInfo(BindingMode.OneWay, false)); } if (bindingDirection == BindingDirection.TwoWay) { return(new BindingModeInfo(mode, true)); } IProperty property = targetNode.TypeResolver.ResolveProperty(targetProperty); if (property != null) { BindableAttribute bindableAttribute = property.Attributes[typeof(BindableAttribute)] as BindableAttribute; if (bindableAttribute != null && bindableAttribute.Direction == BindingDirection.TwoWay) { return(new BindingModeInfo(BindingMode.TwoWay, false)); } } return(new BindingModeInfo(mode, true)); }
private RawDataSourceInfoBase MoveToSpecialDataContextPathExtension(IDataContextAncestorWalker walker, RawDataSourceInfoBase localDataSource) { if (walker.CurrentNode == null) { return((RawDataSourceInfoBase)null); } DataContextPropertyPathExtension propertyPathExtension1 = DataContextMetadata.GetDataContextPropertyPathExtension(walker.CurrentNode, walker.CurrentProperty); if (propertyPathExtension1 == null) { return((RawDataSourceInfoBase)null); } string propertyPathExtension2 = this.GetPropertyPathExtension(walker.CurrentNode, walker.CurrentProperty, propertyPathExtension1); if (propertyPathExtension2 == null) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } if (this.visitedLocations.IsVisited(walker)) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } DocumentNode dataSourceNode = walker.CurrentNode.Properties[(IPropertyId)propertyPathExtension1.Property]; RawDataSourceInfoBase dataSourceInfoBase; if (dataSourceNode == null) { dataSourceInfoBase = (RawDataSourceInfoBase)RawDataSourceInfo.NewEmpty; } else { dataSourceInfoBase = DataContextHelper.GetRawDataSourceInfo(dataSourceNode); if (dataSourceInfoBase.IsValid) { dataSourceInfoBase.AppendClrPath(propertyPathExtension2); } } RawDataSourceInfoBase localDataSource1 = dataSourceInfoBase.CombineWith(localDataSource); walker.MoveTo(walker.CurrentNode, propertyPathExtension1.Property, true); return(this.UnwindElementNameBindingInternal(walker, localDataSource1)); }
public DataContextInfo Evaluate(SceneNode target, IPropertyId targetProperty, bool isForSettingValue) { SceneNode targetNode = target; IProperty targetProperty1 = (IProperty)null; if (targetProperty != null) { targetProperty1 = target.ProjectContext.ResolveProperty(targetProperty); if (DataContextHelper.IsDataContextProperty(target.DocumentNode, (IPropertyId)targetProperty1)) { targetNode = target.Parent; targetProperty1 = (IProperty)null; if (targetNode == null) { return(new DataContextInfo()); } } } return(this.Evaluate((IDataContextAncestorWalker) new DataContextAncestorWalker(targetNode, targetProperty1), isForSettingValue)); }
private void ProcessChangePropertyAction(DataBindingProcessingContext context) { INodeSourceContext containerContext = (INodeSourceContext)null; DocumentCompositeNode bindingNode = context.DocumentCompositeNode.GetValue(DataBindingProcessor.ChangePropetyActionTargetObject, out containerContext) as DocumentCompositeNode; if (bindingNode == null || !bindingNode.Type.IsBinding) { return; } RawDataSourceInfoBase sourceInfoFromBinding = DataContextHelper.GetDataSourceInfoFromBinding(bindingNode); RawDataSourceInfoBase bindingInfo = this.CombineDataSources(context.DataContext, sourceInfoFromBinding); if (!bindingInfo.IsValid) { bindingInfo = this.GetRelativeSourceTargetBindingDataSource(context); } if (bindingInfo == null || !bindingInfo.IsValid) { return; } this.HandleBinding(context, bindingInfo); }
private RawDataSourceInfoBase MoveToDataContextProperty(IDataContextAncestorWalker walker, RawDataSourceInfoBase localDataSource) { if (walker.CurrentNode == null) { return((RawDataSourceInfoBase)null); } DataContextProperty dataContextProperty = DataContextMetadata.GetDataContextProperty(walker.CurrentNode, walker.CurrentProperty); if (dataContextProperty == null) { return((RawDataSourceInfoBase)null); } if (!dataContextProperty.IsValid) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } if (this.visitedLocations.IsVisited(walker)) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } DocumentNode dataContextNode = dataContextProperty.DataContextNode; if (dataContextNode == null) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } this.OnDataSourceFound(walker.CurrentNode, walker.CurrentProperty); RawDataSourceInfoBase rawDataSourceInfo = DataContextHelper.GetRawDataSourceInfo(dataContextNode); if (rawDataSourceInfo.IsValid && dataContextProperty.IsCollectionItem) { rawDataSourceInfo.AppendIndexStep(); } RawDataSourceInfoBase localDataSource1 = rawDataSourceInfo.CombineWith(localDataSource); walker.MoveTo(dataContextProperty.SourceNode, dataContextProperty.Property, true); return(this.UnwindElementNameBindingInternal(walker, localDataSource1)); }
private static ElementDataSourceInfo GetElementNameBinding(DocumentCompositeNode bindingNode) { DocumentNode node = bindingNode.Properties[BindingSceneNode.ElementNameProperty]; if (node == null) { return((ElementDataSourceInfo)null); } string valueAsString = DocumentPrimitiveNode.GetValueAsString(node); if (string.IsNullOrEmpty(valueAsString)) { return(ElementDataSourceInfo.Invalid); } DocumentCompositeNode namedElement = node.FindContainingNameScope().FindNode(valueAsString) as DocumentCompositeNode; if (namedElement == null) { return(ElementDataSourceInfo.Invalid); } string bindingPath = DataContextHelper.GetBindingPath(bindingNode); return(new ElementDataSourceInfo(namedElement, bindingPath)); }
private RawDataSourceInfoBase MoveToElementNameBinding(IDataContextAncestorWalker walker, ElementDataSourceInfo elementBinding) { if (walker.CurrentNode == null || elementBinding == null || elementBinding.RootTargetProperty == null) { return((RawDataSourceInfoBase)null); } if (this.visitedLocations.IsVisited(walker)) { return((RawDataSourceInfoBase)RawDataSourceInfo.Invalid); } this.OnDataSourceFound(walker.CurrentNode, walker.CurrentProperty); if (!walker.MoveTo(elementBinding.RootElement, elementBinding.RootTargetProperty, true)) { return((RawDataSourceInfoBase)null); } DocumentNode dataSourceNode = elementBinding.RootElement.Properties[(IPropertyId)elementBinding.RootTargetProperty]; RawDataSourceInfoBase dataSourceInfoBase = dataSourceNode != null?DataContextHelper.GetRawDataSourceInfo(dataSourceNode) : (RawDataSourceInfoBase)RawDataSourceInfo.NewEmpty; if (dataSourceInfoBase.IsValid) { dataSourceInfoBase.AppendClrPath(elementBinding.NormalizedClrPath); } return(dataSourceInfoBase); }
public static RawDataSourceInfoBase GetRawDataSourceInfo(DocumentNode dataSourceNode) { return(!dataSourceNode.Type.IsBinding ? (!dataSourceNode.Type.IsResource ? (RawDataSourceInfoBase) new RawDataSourceInfo(dataSourceNode, (string)null) : DataContextHelper.GetDataSourceInfoFromResourceReference((DocumentCompositeNode)dataSourceNode)) : DataContextHelper.GetDataSourceInfoFromBinding((DocumentCompositeNode)dataSourceNode)); }
private static IType GetBindingType(DocumentCompositeNode bindingNode) { return(DataContextHelper.GetTypeFromDataSource(DataContextHelper.GetDataSourceInfoFromBinding(bindingNode))); }
public bool IsDataContextLocation(IDataContextAncestorWalker walker) { return(DataContextHelper.IsDataContextProperty((DocumentNode)walker.CurrentNode, (IPropertyId)walker.CurrentProperty)); }
public static bool HasDataContextProperty(IType type) { return(DataContextHelper.GetDataContextProperty(type) != null); }
private bool IsSampleDataTypeNode(DocumentNode compositeNode) { return(this.SampleData.IsTypeOwner(DataContextHelper.GetDataType(compositeNode))); }