Ejemplo n.º 1
0
        private IProperty GetSpecialDefaultBindingProperty(DataBindingDragDropFlags filteredDragFlags)
        {
            DataSchemaNodePath primaryAbsolutePath    = this.DragModel.DataSource.PrimaryAbsolutePath;
            IProperty          defaultBindingProperty = this.GetDefaultBindingProperty(filteredDragFlags, primaryAbsolutePath);

            if (!DataContextMetadata.HasDataContextAttributes(defaultBindingProperty))
            {
                return((IProperty)null);
            }
            DataContextInfo dataContextInfo = new DataContextEvaluator().Evaluate(this.DragModel.TargetNode, (IPropertyId)defaultBindingProperty, true);

            if (dataContextInfo.DataSource.SourceNode != primaryAbsolutePath.Schema.DataSource.DocumentNode)
            {
                return((IProperty)null);
            }
            DataSchemaNodePath nodePathFromPath = primaryAbsolutePath.Schema.GetNodePathFromPath(dataContextInfo.DataSource.Path);

            if (!nodePathFromPath.IsSubpathOf(primaryAbsolutePath))
            {
                return((IProperty)null);
            }
            DataSchemaNodePath relativeNodePath = nodePathFromPath.GetRelativeNodePath(primaryAbsolutePath);

            if (relativeNodePath.CollectionDepth != 0)
            {
                return((IProperty)null);
            }
            this.DragModel.TargetPropertySpecialDataContext = relativeNodePath;
            return(defaultBindingProperty);
        }
Ejemplo n.º 2
0
        protected bool UpdateRelativeSchemaPath()
        {
            DataSchemaNodePath primaryAbsolutePath = this.DragModel.DataSource.PrimaryAbsolutePath;

            this.DragModel.RelativeDropSchemaPath = primaryAbsolutePath;
            DataContextInfo dataContextInfo = new DataContextEvaluator().Evaluate(this.DragModel.TargetNode);

            if (dataContextInfo != null && dataContextInfo.DataSource.IsValidWithSource)
            {
                ISchema schema = primaryAbsolutePath.Schema;
                if (DesignDataHelper.CompareDataSources(dataContextInfo.DataSource.SourceNode, schema.DataSource.DocumentNode))
                {
                    DataSchemaNodePath nodePathFromPath = schema.GetNodePathFromPath(dataContextInfo.DataSource.Path);
                    if (nodePathFromPath == null)
                    {
                        return(true);
                    }
                    if (nodePathFromPath.IsMethod)
                    {
                        return(false);
                    }
                    bool flag = nodePathFromPath.IsSubpathOf(this.DragModel.DataSource[0].AbsolutePath);
                    for (int index = 1; index < this.DragModel.DataSource.Count; ++index)
                    {
                        if (nodePathFromPath.IsSubpathOf(this.DragModel.DataSource[index].AbsolutePath) != flag)
                        {
                            return(false);
                        }
                    }
                    if (flag)
                    {
                        this.DragModel.RelativeDropSchemaPath = nodePathFromPath.GetRelativeNodePath(primaryAbsolutePath);
                    }
                }
            }
            return(true);
        }