Exemplo n.º 1
0
        public static DataContextPropertyPathExtension GetDataContextPropertyPathExtension(DocumentCompositeNode documentNode, IProperty property)
        {
            DataContextPropertyPathExtension extensionInternal = DataContextMetadata.GetDataContextPropertyPathExtensionInternal(documentNode, property);

            if (extensionInternal != null && !extensionInternal.IsValid)
            {
                DataContextMetadata.GetDataContextAttribute <DataContextPathExtensionAttribute>(property);
            }
            return(extensionInternal);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        private string GetPropertyPathExtension(DocumentCompositeNode documentNode, IProperty targetProperty, DataContextPropertyPathExtension pathExtension)
        {
            if (!pathExtension.IsValid)
            {
                return((string)null);
            }
            DocumentNode node = documentNode.Properties[(IPropertyId)targetProperty];

            if (node == null || !PlatformTypes.String.IsAssignableFrom((ITypeId)node.Type))
            {
                return(string.Empty);
            }
            string localPath = DocumentPrimitiveNode.GetValueAsString(node);

            if (pathExtension.IsCollectionItem)
            {
                localPath = ClrObjectSchema.CombinePaths(DataSchemaNode.IndexNodePath, localPath);
            }
            return(localPath);
        }