private static DataContextPropertyPathExtension GetDataContextPropertyPathExtensionInternal(DocumentCompositeNode documentNode, IProperty property) { DataContextPathExtensionAttribute contextAttribute = DataContextMetadata.GetDataContextAttribute <DataContextPathExtensionAttribute>(property); if (contextAttribute == null) { return((DataContextPropertyPathExtension)null); } IProperty property1 = DataContextMetadata.GetProperty((DocumentNode)documentNode, contextAttribute.Property); if (property1 == null || property1 == property) { return(DataContextPropertyPathExtension.Invalid); } return(new DataContextPropertyPathExtension(property1, contextAttribute.IsCollectionItem)); }
private static DataContextProperty GetDataContextPropertyInternal(DocumentCompositeNode documentNode, IProperty property) { DataContextValueSourceAttribute contextAttribute = DataContextMetadata.GetDataContextAttribute <DataContextValueSourceAttribute>(property); if (contextAttribute == null) { return((DataContextProperty)null); } if (string.IsNullOrEmpty(contextAttribute.DataContextValueSourceProperty)) { return(DataContextProperty.Invalid); } PropertyReference ancestorPath = (PropertyReference)null; DocumentCompositeNode sourceNode; if (!string.IsNullOrEmpty(contextAttribute.AncestorPath)) { DataContextMetadata.AncestorPropertyPath ancestorPropertyPath = DataContextMetadata.AncestorPropertyPathParser.Parse(documentNode, contextAttribute.AncestorPath); if (ancestorPropertyPath == null) { return(DataContextProperty.Invalid); } sourceNode = ancestorPropertyPath.AncestorNode; ancestorPath = ancestorPropertyPath.PropertyPath; } else { sourceNode = documentNode; } if (sourceNode == null) { return(DataContextProperty.Invalid); } IProperty property1 = DataContextMetadata.GetProperty((DocumentNode)sourceNode, contextAttribute.DataContextValueSourceProperty); if (property1 == null || property1 == property) { return(DataContextProperty.Invalid); } return(new DataContextProperty(sourceNode, property1, contextAttribute.IsCollectionItem, ancestorPath)); }