private void UpdateTooltip()
        {
            DataSchemaNodePath primaryAbsolutePath = this.DragModel.DataSource.PrimaryAbsolutePath;

            if (primaryAbsolutePath.IsMethod)
            {
                string pathName = primaryAbsolutePath.Node.PathName;
                string str      = new DataSchemaNodePath(primaryAbsolutePath.Schema, primaryAbsolutePath.Node.Parent).Path;
                if (string.IsNullOrEmpty(str))
                {
                    str = this.DragModel.DataSourceName;
                }
                this.DragModel.Tooltip = string.Format((IFormatProvider)CultureInfo.InvariantCulture, StringTable.ArtboardBindTriggerActionTooltip, new object[2]
                {
                    (object)pathName,
                    (object)str
                });
            }
            else
            {
                string str = primaryAbsolutePath.Path;
                if (string.IsNullOrEmpty(str))
                {
                    str = this.DragModel.DataSourceName;
                }
                this.DragModel.Tooltip = string.Format((IFormatProvider)CultureInfo.InvariantCulture, StringTable.ArtboardBindInvokeCommandActionTooltip, new object[1]
                {
                    (object)str
                });
            }
        }
Ejemplo n.º 2
0
        private void GenerateDataGridColumnsIfNeeded(DataGridElement dataGridElement, IProperty targetProperty)
        {
            if (!DataGridElement.ItemsSourceProperty.Equals((object)targetProperty) && !ItemsControlElement.ItemsSourceProperty.Equals((object)targetProperty) || this.DragModel.RelativeDropSchemaPath.IsProperty)
            {
                return;
            }
            IList <DataSchemaNodePath> relativeSchemaPaths = this.GetRelativeSchemaPaths();

            if (relativeSchemaPaths.Count == 0)
            {
                return;
            }
            using (SceneEditTransaction editTransaction = this.DragModel.Document.CreateEditTransaction(StringTable.UndoUnitCreateTemplate))
            {
                dataGridElement.SetValue(DataGridElement.AutoGenerateColumnsProperty, (object)false);
                ISceneNodeCollection <SceneNode> columnCollection = dataGridElement.ColumnCollection;
                for (int index = 0; index < relativeSchemaPaths.Count; ++index)
                {
                    DataSchemaNodePath schemaPath = relativeSchemaPaths[index];
                    IType type = schemaPath.Type;
                    if (type.NullableType != null)
                    {
                        type = type.NullableType;
                    }
                    SceneNode sceneNode = !PlatformTypes.Boolean.IsAssignableFrom((ITypeId)type) ? (!PlatformTypes.IConvertible.IsAssignableFrom((ITypeId)type) ? this.CreateDataGridTemplateColumn(schemaPath) : this.CreateDataGridBoundColumn(schemaPath, ProjectNeutralTypes.DataGridTextColumn)) : this.CreateDataGridBoundColumn(schemaPath, ProjectNeutralTypes.DataGridCheckBoxColumn);
                    columnCollection.Add(sceneNode);
                }
                editTransaction.Commit();
            }
        }
 public override bool CanHandle()
 {
     if (this.DragModel.DataSource.FindIndex((Predicate <DataSchemaNodePath>)(schemaPath =>
     {
         if (schemaPath.IsMethod)
         {
             return(true);
         }
         if (schemaPath.IsProperty)
         {
             return(PlatformTypes.ICommand.IsAssignableFrom((ITypeId)schemaPath.Type));
         }
         return(false);
     })) < 0)
     {
         return(false);
     }
     if (this.DragModel.DataSource.Count == 1)
     {
         DataSchemaNodePath primarySchemaNodePath = this.DragModel.DataSource.PrimarySchemaNodePath;
         if (primarySchemaNodePath.IsProperty)
         {
             BindingPropertyMatchInfo bindingPropertyInfo = BindingPropertyHelper.GetDefaultBindingPropertyInfo(this.DragModel.TargetNode, primarySchemaNodePath.Type);
             if (bindingPropertyInfo.Property != null && bindingPropertyInfo.Compatibility == BindingPropertyCompatibility.Assignable)
             {
                 return(false);
             }
         }
     }
     if (!this.UpdateDragModelInternal())
     {
         this.DragModel.DropFlags = DataBindingDragDropFlags.None;
     }
     return(this.DragModel.DropFlags != DataBindingDragDropFlags.None);
 }
Ejemplo n.º 4
0
        private bool SetBinding(SceneNode targetNode, ref IProperty targetProperty)
        {
            ReferenceStep targetProperty1 = (ReferenceStep)null;

            if (targetProperty != null)
            {
                targetProperty1 = this.DragModel.DocumentContext.TypeResolver.ResolveProperty((IPropertyId)targetProperty) as ReferenceStep;
            }
            DataSchemaNodePath bindingPath = new DataSchemaNodePath(this.DragModel.DataSource.PrimaryAbsoluteSchema, this.DragModel.RelativeDropSchemaPath.Node);
            SceneNode          setBindingOrData;

            if (targetProperty1 == null)
            {
                bool useDesignDataContext = DataBindingModeModel.Instance.NormalizedMode == DataBindingMode.Details;
                setBindingOrData = MiniBindingDialog.CreateAndSetBindingOrData(bindingPath, targetNode, useDesignDataContext, ref targetProperty1);
            }
            else
            {
                setBindingOrData = this.DragModel.ViewModel.BindingEditor.CreateAndSetBindingOrData(targetNode, (IPropertyId)targetProperty1, bindingPath);
            }
            if (setBindingOrData == null)
            {
                return(false);
            }
            if (targetProperty != null)
            {
                this.GenerateDetailsIfNeeded(targetNode, (IProperty)targetProperty1);
            }
            targetProperty = (IProperty)targetProperty1;
            return(true);
        }
Ejemplo n.º 5
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.º 6
0
 private static string GetColumnName(DataSchemaNodePath schemaPath)
 {
     for (DataSchemaNode dataSchemaNode = schemaPath.Node; dataSchemaNode != null; dataSchemaNode = dataSchemaNode.Parent)
     {
         if (dataSchemaNode.PathName != DataSchemaNode.IndexNodePath)
         {
             return(dataSchemaNode.PathName);
         }
     }
     return("_");
 }
 public void RebindFields(SceneViewModel viewModel, ISchema schema, IList <DataSchemaNodePath> viewEntries)
 {
     for (int index = 0; index < viewEntries.Count; ++index)
     {
         DataSchemaNodePath    dataSchemaNodePath = viewEntries[index];
         DataSchemaNodePath    bindingPath        = new DataSchemaNodePath(schema, dataSchemaNodePath.Node);
         DocumentCompositeNode fieldNode          = (DocumentCompositeNode)this.records[index].Field;
         SceneNode             sceneNode          = viewModel.GetSceneNode((DocumentNode)fieldNode);
         IProperty             property           = Enumerable.First <IProperty>((IEnumerable <IProperty>)fieldNode.Properties.Keys, (Func <IProperty, bool>)(p => fieldNode.Properties[(IPropertyId)p].Type.IsBinding));
         viewModel.BindingEditor.CreateAndSetBindingOrData(sceneNode, (IPropertyId)property, bindingPath);
     }
 }
Ejemplo n.º 8
0
        private SceneNode CreateDataGridTemplateColumn(DataSchemaNodePath schemaPath)
        {
            DataGridColumnNode dataGridColumnNode = (DataGridColumnNode)this.DragModel.ViewModel.CreateSceneNode(ProjectNeutralTypes.DataGridTemplateColumn);
            string             columnName         = DataBindingDragDropDefaultHandler.GetColumnName(schemaPath);

            dataGridColumnNode.SetLocalValue(DataGridColumnNode.ColumnHeaderProperty, (object)columnName);
            string resourceNameBase        = columnName + "Template";
            List <DataSchemaNodePath> list = new List <DataSchemaNodePath>()
            {
                schemaPath
            };

            DataViewFactory.CreateDataTemplateResource((SceneNode)dataGridColumnNode, DataGridColumnNode.TemplateColumnCellTemplateProperty, resourceNameBase, (IList <DataSchemaNodePath>)list, DataViewCategory.DataTemplate, PlatformTypes.DataTemplate);
            return((SceneNode)dataGridColumnNode);
        }
Ejemplo n.º 9
0
        private void ProcessSingleSchemaPath(DataViewBuilderContext context, DataSchemaNodePath schemaPath, DataViewTemplate dataViewTemplate)
        {
            DataViewTemplateEntry templateEntryInternal = this.GetDataViewTemplateEntryInternal(schemaPath.Type, dataViewTemplate);

            if (templateEntryInternal == null)
            {
                return;
            }
            context.CurrentSchemaPath = schemaPath;
            context.CurrentLabelNode  = (DocumentCompositeNode)null;
            context.CurrentFieldNode  = (DocumentCompositeNode)null;
            this.CreateLabelElement(context, templateEntryInternal);
            this.CreateFieldElement(context, templateEntryInternal);
            this.layoutBuilder.SetElementLayout(context);
        }
        private bool UpdateInvokeCommandAction(SceneNode actionNode)
        {
            if (!ProjectNeutralTypes.InvokeCommandAction.IsAssignableFrom((ITypeId)actionNode.Type))
            {
                return(false);
            }
            DataSchemaNodePath primaryAbsolutePath = this.DragModel.DataSource.PrimaryAbsolutePath;
            BindingSceneNode   bindingSceneNode    = this.DragModel.ViewModel.BindingEditor.CreateAndSetBindingOrData(actionNode, DataBindingDragDropAddTriggerHandler.CommandProperty, primaryAbsolutePath) as BindingSceneNode;

            if (bindingSceneNode == null)
            {
                return(false);
            }
            bindingSceneNode.ClearLocalValue(BindingSceneNode.ModeProperty);
            return(true);
        }
Ejemplo n.º 11
0
        private SceneNode CreateDataGridBoundColumn(DataSchemaNodePath schemaPath, ITypeId columnType)
        {
            DataGridColumnNode dataGridColumnNode = (DataGridColumnNode)this.DragModel.ViewModel.CreateSceneNode(columnType);
            string             columnName         = DataBindingDragDropDefaultHandler.GetColumnName(schemaPath);

            dataGridColumnNode.SetLocalValue(DataGridColumnNode.ColumnHeaderProperty, (object)columnName);
            BindingSceneNode bindingSceneNode = (BindingSceneNode)this.DragModel.ViewModel.CreateSceneNode(PlatformTypes.Binding);

            bindingSceneNode.SetPath(schemaPath.Path);
            BindingModeInfo defaultBindingMode = BindingPropertyHelper.GetDefaultBindingMode(dataGridColumnNode.DocumentNode, DataGridColumnNode.BoundColumnBindingProperty, schemaPath);

            if (!defaultBindingMode.IsOptional)
            {
                bindingSceneNode.Mode = defaultBindingMode.Mode;
            }
            dataGridColumnNode.SetValueAsSceneNode(DataGridColumnNode.BoundColumnBindingProperty, (SceneNode)bindingSceneNode);
            return((SceneNode)dataGridColumnNode);
        }
Ejemplo n.º 12
0
        public bool CanCreateAndSetBindingOrData(SceneNode target, DataSchemaNodePath bindingPath, bool useSourceInherited)
        {
            IPropertyId targetProperty;

            if (PlatformTypes.FrameworkElement.IsAssignableFrom((ITypeId)target.Type))
            {
                targetProperty = BaseFrameworkElement.WidthProperty;
            }
            else
            {
                targetProperty = (IPropertyId)Enumerable.FirstOrDefault <ReferenceStep>((IEnumerable <ReferenceStep>)BindingPropertyHelper.GetBindableTargetProperties(target), (Func <ReferenceStep, bool>)(prop => !DataContextHelper.IsDataContextProperty(target.DocumentNode, (IPropertyId)prop)));
                if (targetProperty == null)
                {
                    return(false);
                }
            }
            return(this.CanCreateAndSetBindingOrDataInternal(target, targetProperty, bindingPath, useSourceInherited));
        }
        private bool UpdateCallMethodAction(SceneNode actionNode)
        {
            if (!ProjectNeutralTypes.CallMethodAction.IsAssignableFrom((ITypeId)actionNode.Type))
            {
                return(false);
            }
            DataSchemaNodePath primaryAbsolutePath = this.DragModel.DataSource.PrimaryAbsolutePath;
            DataSchemaNode     node             = primaryAbsolutePath.Node;
            DataSchemaNodePath bindingPath      = new DataSchemaNodePath(primaryAbsolutePath.Schema, node.Parent);
            BindingSceneNode   bindingSceneNode = this.DragModel.ViewModel.BindingEditor.CreateAndSetBindingOrData(actionNode, DataBindingDragDropAddTriggerHandler.TargetObjectProperty, bindingPath) as BindingSceneNode;

            if (bindingSceneNode == null)
            {
                return(false);
            }
            bindingSceneNode.ClearLocalValue(BindingSceneNode.ModeProperty);
            actionNode.SetValue(DataBindingDragDropAddTriggerHandler.MethodNameProperty, (object)node.PathName);
            return(true);
        }
Ejemplo n.º 14
0
        public static ISchema GetSchemaForDataSourceInfo(DataSourceInfo dataSource)
        {
            if (dataSource == null || !dataSource.IsValidWithSource)
            {
                return((ISchema) new EmptySchema());
            }
            string  errorMessage;
            ISchema schema = ProjectXamlContext.FromDocumentNode(dataSource.SourceNode).SchemaManager.GetSchemaForDataSourceInternal(dataSource.SourceNode, out errorMessage);

            if (schema != null && !string.IsNullOrEmpty(dataSource.Path))
            {
                DataSchemaNodePath nodePathFromPath = schema.GetNodePathFromPath(dataSource.Path);
                if (nodePathFromPath != null)
                {
                    schema = nodePathFromPath.RelativeSchema;
                }
            }
            return(schema);
        }
Ejemplo n.º 15
0
        private List <DataSchemaNode> GetNodesToCreateElements()
        {
            IPlatform             platform = this.DragModel.Platform;
            List <DataSchemaNode> list     = new List <DataSchemaNode>();
            bool             flag          = DataBindingModeModel.Instance.NormalizedMode == DataBindingMode.Default;
            DataViewCategory category      = flag ? DataViewCategory.Master : DataViewCategory.Details;

            if (flag && this.DragModel.DataSource.Count == 1 && this.DragModel.DataSource.PrimarySchemaNodePath.IsCollection)
            {
                DataSchemaNode collectionItemNode = this.DragModel.DataSource.PrimarySchemaNodePath.EffectiveCollectionItemNode;
                IType          type = collectionItemNode.ResolveType(this.DragModel.TargetNode.DocumentNode.TypeResolver);
                if (PlatformTypes.IConvertible.IsAssignableFrom((ITypeId)type) || PlatformTypes.ImageSource.IsAssignableFrom((ITypeId)type))
                {
                    list.Add(collectionItemNode);
                }
                else
                {
                    foreach (DataSchemaNode dataSchemaNode in collectionItemNode.Children)
                    {
                        IType dataType = dataSchemaNode.ResolveType(this.DragModel.TargetNode.DocumentNode.TypeResolver);
                        if (DataViewFactory.GetDataViewTemplateEntry(platform, dataType, category) != null)
                        {
                            list.Add(dataSchemaNode);
                        }
                    }
                }
            }
            else
            {
                for (int index = 0; index < this.DragModel.DataSource.Count; ++index)
                {
                    DataSchemaNodePath dataSchemaNodePath = this.DragModel.DataSource[index];
                    if (DataViewFactory.GetDataViewTemplateEntry(platform, dataSchemaNodePath.Type, category) != null)
                    {
                        list.Add(dataSchemaNodePath.Node);
                    }
                }
            }
            list.Sort((Comparison <DataSchemaNode>)((a, b) => StringLogicalComparer.Instance.Compare(a.PathName, b.PathName)));
            return(list);
        }
Ejemplo n.º 16
0
        private SceneNode CreateDataSource(SceneNode target, DataSchemaNodePath bindingPath, bool isSourcePathLess)
        {
            DocumentNode resourceKey = bindingPath.Schema.DataSource.ResourceKey;

            if (resourceKey == null)
            {
                if (!isSourcePathLess && !string.IsNullOrEmpty(bindingPath.Path))
                {
                    return((SceneNode)null);
                }
                DocumentNode documentNode   = bindingPath.Schema.DataSource.DocumentNode;
                IProjectItem designDataFile = DesignDataHelper.GetDesignDataFile(documentNode);
                DocumentNode node;
                if (designDataFile != null)
                {
                    node = DesignDataHelper.CreateDesignDataExtension(designDataFile, target.DocumentContext);
                }
                else
                {
                    if (PlatformTypes.FrameworkElement.IsAssignableFrom((ITypeId)bindingPath.Schema.DataSource.DocumentNode.Type))
                    {
                        return((SceneNode)null);
                    }
                    node = documentNode.Clone(target.DocumentContext);
                }
                return(target.ViewModel.GetSceneNode(node));
            }
            if (!this.EnsureDataSourceReachable(target, bindingPath.Schema.DataSource))
            {
                return((SceneNode)null);
            }
            BindingSceneNode bindingSceneNode = BindingSceneNode.Factory.Instantiate(target.ViewModel);
            DocumentNode     keyNode          = resourceKey.Clone(target.DocumentContext);

            bindingSceneNode.Source = (DocumentNode)DocumentNodeUtilities.NewStaticResourceNode(keyNode.Context, keyNode);
            return((SceneNode)bindingSceneNode);
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
0
        private static void SetBindingOrData(SceneNode targetNode, IPropertyId targetProperty, SceneNode bindingOrData, DataSchemaNodePath bindingPath)
        {
            BindingSceneNode binding = bindingOrData as BindingSceneNode;

            using (targetNode.ViewModel.AnimationEditor.DeferKeyFraming())
            {
                if (binding != null)
                {
                    IPropertyId propertyKey = targetProperty;
                    if (binding.Source != null)
                    {
                        propertyKey = BindingEditor.RefineDataContextProperty(targetNode, targetProperty, bindingPath.Schema.DataSource.DocumentNode);
                    }
                    targetNode.SetBinding(propertyKey, binding);
                }
                else
                {
                    IPropertyId propertyKey = BindingEditor.RefineDataContextProperty(targetNode, targetProperty, bindingOrData.DocumentNode);
                    targetNode.SetValueAsSceneNode(propertyKey, bindingOrData);
                }
            }
        }
Ejemplo n.º 19
0
        private bool SetSourceAsDataContext(SceneNode target, IPropertyId targetPropertyId, ref DataSchemaNodePath bindingPath, bool testOnly)
        {
            if (target == null || targetPropertyId == null)
            {
                return(false);
            }
            IProperty property = target.ProjectContext.ResolveProperty(targetPropertyId);

            if (property == null)
            {
                return(false);
            }
            SceneNode sceneNode      = target;
            IProperty targetProperty = property;

            if (DataContextHelper.IsDataContextProperty(target.DocumentNode, (IPropertyId)property))
            {
                sceneNode      = sceneNode.Parent;
                targetProperty = (IProperty)null;
                if (sceneNode == null || sceneNode.Parent == null)
                {
                    return(false);
                }
            }
            DataSourceInfo  dataSourceInfo   = new DataSourceInfo(bindingPath);
            DataContextInfo contextPlacement = DataContextPlacementEvaluator.FindDataContextPlacement(sceneNode, targetProperty, dataSourceInfo);

            if (contextPlacement == null || contextPlacement.DataSourceMatch == DataSourceMatchCriteria.Ignore)
            {
                return(false);
            }
            if (contextPlacement.DataSourceMatch == DataSourceMatchCriteria.Exact || contextPlacement.DataSourceMatch == DataSourceMatchCriteria.Compatible)
            {
                if (contextPlacement.DataSourceMatch == DataSourceMatchCriteria.Exact)
                {
                    bindingPath = bindingPath.GetRelativeNodePath(bindingPath);
                }
                else if (!string.IsNullOrEmpty(contextPlacement.DataSource.Path))
                {
                    DataSchemaNodePath nodePathFromPath = bindingPath.Schema.GetNodePathFromPath(contextPlacement.DataSource.Path);
                    bindingPath = nodePathFromPath.GetRelativeNodePath(bindingPath);
                }
                return(true);
            }
            if (contextPlacement.DataSourceMatch == DataSourceMatchCriteria.Any && contextPlacement.Owner != null && (contextPlacement.Owner != target.DocumentNode || contextPlacement.Property == null || !contextPlacement.Property.Equals((object)property)))
            {
                IProperty dataContextProperty = DataContextHelper.GetDataContextProperty(contextPlacement.Owner.Type);
                if (dataContextProperty != null)
                {
                    SceneNode ownerSceneNode = contextPlacement.GetOwnerSceneNode(target.ViewModel);
                    SceneNode dataSource     = this.CreateDataSource(ownerSceneNode, bindingPath, true);
                    if (dataSource != null)
                    {
                        if (!testOnly)
                        {
                            BindingEditor.SetBindingOrData(ownerSceneNode, (IPropertyId)dataContextProperty, dataSource, bindingPath);
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 20
0
        public SceneNode CreateBindingOrData(SceneNode target, IPropertyId targetProperty, DataSchemaNodePath bindingPath, bool useSourceInherited)
        {
            BindingSceneNode bindingSceneNode;

            if (!useSourceInherited || !this.SetSourceAsDataContext(target, targetProperty, ref bindingPath, false))
            {
                SceneNode dataSource = this.CreateDataSource(target, bindingPath, false);
                bindingSceneNode = dataSource as BindingSceneNode;
                if (bindingSceneNode == null)
                {
                    return(dataSource);
                }
            }
            else
            {
                bindingSceneNode = BindingSceneNode.Factory.Instantiate(target.ViewModel);
            }
            string path = bindingPath.Path;

            if (bindingPath.Schema is XmlSchema)
            {
                bindingSceneNode.XPath = path;
            }
            else if (!string.IsNullOrEmpty(path))
            {
                bindingSceneNode.SetPath(path);
            }
            BindingModeInfo defaultBindingMode = BindingPropertyHelper.GetDefaultBindingMode(target.DocumentNode, targetProperty, bindingPath);

            if (!defaultBindingMode.IsOptional)
            {
                bindingSceneNode.Mode = defaultBindingMode.Mode;
            }
            return((SceneNode)bindingSceneNode);
        }
Ejemplo n.º 21
0
        public SceneNode CreateAndSetBindingOrData(SceneNode target, IPropertyId targetProperty, DataSchemaNodePath bindingPath, bool useSourceInherited)
        {
            SceneNode bindingOrData = this.CreateBindingOrData(target, targetProperty, bindingPath, useSourceInherited);

            if (bindingOrData != null)
            {
                BindingEditor.SetBindingOrData(target, targetProperty, bindingOrData, bindingPath);
            }
            return(bindingOrData);
        }
Ejemplo n.º 22
0
 public SceneNode CreateAndSetBindingOrData(SceneNode target, IPropertyId targetProperty, DataSchemaNodePath bindingPath)
 {
     return(this.CreateAndSetBindingOrData(target, targetProperty, bindingPath, true));
 }
Ejemplo n.º 23
0
 private bool CanCreateAndSetBindingOrDataInternal(SceneNode target, IPropertyId targetProperty, DataSchemaNodePath bindingPath, bool useSourceInherited)
 {
     return(useSourceInherited && this.SetSourceAsDataContext(target, targetProperty, ref bindingPath, true) || this.CreateDataSource(target, bindingPath, false) != null);
 }
Ejemplo n.º 24
0
 public bool CanCreateAndSetBindingOrData(SceneNode target, IPropertyId targetProperty, DataSchemaNodePath bindingPath, bool useSourceInherited)
 {
     if (targetProperty == null)
     {
         return(this.CanCreateAndSetBindingOrData(target, bindingPath, useSourceInherited));
     }
     return(this.CanCreateAndSetBindingOrDataInternal(target, targetProperty, bindingPath, useSourceInherited));
 }
Ejemplo n.º 25
0
        private IProperty GetDefaultBindingProperty(DataBindingDragDropFlags filteredDragFlags, DataSchemaNodePath schemaPath)
        {
            IType     type = schemaPath.Type;
            IProperty property;

            if (!schemaPath.IsCollection || schemaPath.Node.Type == (Type)null || !(schemaPath.Schema is XmlSchema))
            {
                property = this.GetDefaultBindingProperty(filteredDragFlags, type);
            }
            else
            {
                IType dataType = this.ProjectContext.ResolveType(PlatformTypes.ICollection);
                property = !type.IsAssignableFrom((ITypeId)dataType) ? this.GetDefaultBindingProperty(filteredDragFlags, dataType) ?? this.GetDefaultBindingProperty(filteredDragFlags, type) : this.GetDefaultBindingProperty(filteredDragFlags, type);
            }
            return(property);
        }
Ejemplo n.º 26
0
 public void InitCollectionDepth(DataSchemaNodePath schemaPath)
 {
     this.collectionDepth = schemaPath.CollectionDepth;
 }