Пример #1
0
        private DataBindingDragDropModel GetDragFeedback(DragEventArgs args)
        {
            DataSchemaNodePathCollection result = (DataSchemaNodePathCollection)null;

            if (!DragSourceHelper.FirstDataOfType <DataSchemaNodePathCollection>(args.Data, ref result) || result == null)
            {
                return((DataBindingDragDropModel)null);
            }
            SceneNode sceneNode = (SceneNode)this.ActiveView.GetSelectableElementAtPoint(args.GetPosition((IInputElement)this.ActiveView.ViewRootContainer), SelectionFor3D.None, false, false);

            if (sceneNode == null)
            {
                sceneNode = (SceneNode)this.ActiveSceneViewModel.FindPanelClosestToActiveEditingContainer();
                if (sceneNode == null)
                {
                    return((DataBindingDragDropModel)null);
                }
            }
            if (PlatformTypes.FrameworkTemplate.IsAssignableFrom((ITypeId)sceneNode.Type))
            {
                sceneNode = sceneNode.GetLocalValueAsSceneNode(FrameworkTemplateElement.VisualTreeProperty);
                if (sceneNode == null)
                {
                    return((DataBindingDragDropModel)null);
                }
            }
            BindingSceneInsertionPoint insertionPoint = new BindingSceneInsertionPoint(sceneNode, (IProperty)null, -1);

            return(DataBindingDragDropManager.GetDragFeedback(result, insertionPoint, DataBindingDragDropFlags.ArtboardDefault, Keyboard.Modifiers));
        }
 public DataBindingDragDropModel(DataSchemaNodePathCollection dataSource, BindingSceneInsertionPoint insertionPoint, DataBindingDragDropFlags dragFlags, ModifierKeys modifiers)
 {
     this.DataSource     = dataSource;
     this.InsertionPoint = insertionPoint;
     this.DragFlags      = dragFlags;
     this.Modifiers      = modifiers;
 }
        public static DataBindingDragDropModel GetDragFeedback(DataSchemaNodePathCollection information, BindingSceneInsertionPoint insertionPoint, DataBindingDragDropFlags dragFlags, ModifierKeys modifiers)
        {
            bool flag = (modifiers & ModifierKeys.Alt) == ModifierKeys.Alt;

            if (!DataBindingDragDropManager.isAltModifier.HasValue)
            {
                if (flag)
                {
                    DataBindingModeModel.Instance.SetMode(DataBindingMode.Details, false);
                }
            }
            else if (DataBindingDragDropManager.isAltModifier.Value != flag)
            {
                DataBindingModeModel.Instance.SetMode(flag ? DataBindingMode.Details : DataBindingMode.Default, false);
            }
            DataBindingDragDropManager.isAltModifier = new bool?(flag);
            if ((modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
            {
                dragFlags &= ~DataBindingDragDropFlags.AutoPickProperty;
                dragFlags &= ~DataBindingDragDropFlags.AllowRetargetElement;
            }
            if (insertionPoint.Property != null)
            {
                dragFlags &= ~DataBindingDragDropFlags.CreateElement;
            }
            if (!BindingPropertyHelper.HasBindableProperties(insertionPoint.SceneNode))
            {
                dragFlags &= ~(DataBindingDragDropFlags.SetBinding | DataBindingDragDropFlags.AutoPickProperty);
            }
            DataBindingDragDropModel bindingDragDropModel = new DataBindingDragDropModel(information, insertionPoint, dragFlags, modifiers);

            if (!DataBindingDragDropModel.Equals(bindingDragDropModel, DataBindingDragDropManager.effectiveDragModel))
            {
                PerformanceUtility.StartPerformanceSequence(PerformanceEvent.DataBindingDragModelUpdate);
                DataBindingDragDropManager.effectiveDragModel = DataBindingDragDropManager.UpdateDragModel(bindingDragDropModel);
                PerformanceUtility.EndPerformanceSequence(PerformanceEvent.DataBindingDragModelUpdate);
            }
            return(DataBindingDragDropManager.effectiveDragModel);
        }
Пример #4
0
        protected virtual bool OnDragOver(DragEventArgs args)
        {
            DataSchemaNodePathCollection result = (DataSchemaNodePathCollection)null;

            if (DragSourceHelper.FirstDataOfType <DataSchemaNodePathCollection>(args.Data, ref result) && !(this is DataBindingToolBehavior))
            {
                this.PushBehavior((ToolBehavior) new DataBindingToolBehavior(this.ToolBehaviorContext));
            }
            else if (args.Data.GetDataPresent("ResourceEntryItem", true) && !(this is ResourceToolBehavior))
            {
                this.PushBehavior((ToolBehavior) new ResourceToolBehavior(this.ToolBehaviorContext));
            }
            else if (args.Data.GetDataPresent(DataFormats.FileDrop) || args.Data.GetDataPresent("BlendProjectItem") && !(this is FileDropToolBehavior))
            {
                this.PushBehavior((ToolBehavior) new FileDropToolBehavior(this.ToolBehaviorContext));
            }
            else if (AssetDropToolBehavior.CanHandleDropData(args.Data) && !(this is AssetDropToolBehavior))
            {
                this.PushBehavior((ToolBehavior) new AssetDropToolBehavior(this.ToolBehaviorContext));
            }
            return(false);
        }