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 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); }
protected override bool OnDrop(DragEventArgs args) { this.previewHighlighter.Option = HighlightOption.Default; this.previewHighlighter.InsertionPointPreview = (ISceneInsertionPoint)null; this.FeedbackAdorner.CloseAdorner(); DataBindingDragDropModel dragFeedback = this.GetDragFeedback(args); bool flag = false; if (dragFeedback != null && dragFeedback.CheckDropFlags(DataBindingDragDropFlags.SetBinding | DataBindingDragDropFlags.CreateElement, false)) { Point position = args.GetPosition((IInputElement)this.ActiveView.ViewRootContainer); this.ToolBehaviorContext.SnappingEngine.Start(this.ToolBehaviorContext, (BaseFrameworkElement)null, (IList <BaseFrameworkElement>)null); Point artboardSnappedDropPoint = this.ToolBehaviorContext.SnappingEngine.SnapPoint(position, EdgeFlags.TopLeft) * this.ActiveView.GetComputedTransformFromRoot((SceneElement)dragFeedback.TargetNode); this.ToolBehaviorContext.SnappingEngine.Stop(); flag = DataBindingDragDropManager.Drop(dragFeedback, artboardSnappedDropPoint); } if (!this.IsSuspended) { this.PopSelf(); } return(flag); }
public void Dispose() { DataBindingDragDropManager.Reset(); DataBindingModeModel.Instance.SetMode(this.originalMode, true); GC.SuppressFinalize((object)this); }
public DragDropToken() { this.originalMode = DataBindingModeModel.Instance.Mode; DataBindingDragDropManager.Reset(); }