DraggingTool
The DraggingTool is used to move or copy selected parts with the mouse.
Inherits: DiagramTool
Properties
CopiedParts : Dictionary<Part, Info>
Gets or sets the collection of parts that this tool has copied.
CopiesEffectiveCollection : bool
Gets or sets whether for a copying operation the extended selection is copied or only selected parts.
CurrentPart : Part
Gets or sets the Part found at the mouse point by StandardMouseSelect.
DraggableLinks : bool
Gets or sets whether the user can drag a single Link, disconnecting it from its connected nodes and possibly connecting it to valid ports when the link is dropped.
DraggedLink : Link
Gets or sets the Link that may be dragged and reconnected when DraggableLinks is true.
DraggedParts : Dictionary<Part, Info>
Gets or sets the collection of Parts being dragged.
DragOutStarted : bool
Gets or sets whether a potentially external drag-and-drop has been started by this tool.
DragOverPart : Part
Gets or sets a Part, not being dragged, that the mouse is over, and sets its IsDropOntoAccepted property appropriately.
DragOverSnapArea : DragOverSnapArea
Gets or sets whether dragging any parts over the diagram or over any parts causes their position to be snapped to grid points.
DropOntoEnabled : bool
Gets or sets whether stationary parts get their IsDropOntoAccepted property temporarily set to true during a drag.
FromPortId : string
Gets or sets the port identifier used when Point) creates a new link due to DropOntoBehavior is AddsLinkFromNode, AddsLinkToNode, or SplicesIntoLink.
Inclusions : EffectiveCollectionInclusions
Gets or sets whether moving or copying a node also includes all of the node's children and their descendants, along with the links to those additional nodes.
IsRealtime : bool
Gets or sets whether parts move continuously during a drag or if a simple object is dragged instead, with the parts actually moving only upon a mouse up.
Source : DraggingTool
This is an experimental property that gets the DraggingTool that is the source of a simulated drag-and-drop.
StartPoint : Point
Gets or sets the mouse point from which parts start to move.
Methods
AcceptData(IDataObject) : IDataCollection
Convert an IDataObject into an IDataCollection.
- dataobj
- An IDataObject, typically the value of DragEventArgs.Data
Returns: An IDataCollection that the diagram's model can copy
CanStart() : bool
This tool can run if this diagram allows selection and moves/copies/dragging-out, if the mouse has moved far enough away to be a drag and not a click, and if FindDraggablePart has found a selectable part at the mouse-down point.
ComputeEffectiveCollection(IEnumerable<Part>) : Dictionary<Part, Info>
Find the actual collection of nodes and links to be moved or copied, given an initial collection.
- parts
Returns: a Dictionary of Parts, mapped to Infos holding their original Locations
ComputeFocusPoint(IEnumerable<Part>) : Point
Determine the focus point or hot-spot point for an external drag.
- parts
- the copied Nodes and Links being dragged
Returns: a Point in model coordinates
ComputeMove(Node, Point, Dictionary<Part, Info>) : Point
This method computes the new location for a node, given a new desired location and a dictionary of dragged parts.
- n
- the Node being moved
- newloc
- the proposed new Location for the node , in model coordinates
- draggedparts
- a Dictionary of Parts being dragged
Returns: a new location for the node, in model coordinates
ConsiderDragOver(Point, Part) : bool
Determine if the currently dragged selection (DraggedParts or CopiedParts) would be valid to be dropped onto the target part , depending on its DropOntoBehavior.
- pt
- normally the current mouse point, in model coordinates
- p
- the Part under the mouse point that the selection might be dropped onto
ConsiderSnapTo(Node, Point, Node, Dictionary<Part, Info>) : bool
This predicate is true if the given node can control the movement of the given node.
- moving
- the Node being dragged
- pt
- a Point in model coordinates, typically the current mouse point
- snapper
- the Node that might control the node's movement
- draggedparts
- a Dictionary of Parts being dragged
Returns: true if the is not in the and is DragOverSnapEnabled
DoActivate()
Start the dragging operation.
DoCancel()
Abort any dragging operation.
DoDragDrop(IDataCollection, DragDropEffects) : DragDropEffects
Call DragDrop.DoDragDrop.
- data
- this represents the data to be dragged
- eff
- this is passed as the third argument to DragDrop.DoDragDrop
Returns: the result of calling DragDrop.DoDragDrop
DoDragOut()
Start a drag-and-drop operation.
DoDragOver(DragEventArgs)
For copies or external moves, create and move copied parts for the drag-and-drop data.
- e
DoKeyDown(KeyEventArgs)
Handle switching between copying and moving modes as the Control key is pressed or released.
- e
DoKeyUp(KeyEventArgs)
Handle switching between copying and moving modes as the Control key is pressed or released.
- e
DoMouseMove()
As the user moves the mouse, move the collection of CopiedParts or DraggedParts, depending on whether MayCopy or MayMove is true.
DoMouseUp()
On a mouse-up finish moving or copying the effective selection.
DoQueryContinueDrag(QueryContinueDragEventArgs)
If the user hits the ESCAPE key, call DoCancel to abort this tool.
- e
DoStop()
Finish and clean-up after a dragging operation.
DragOver(Point, bool, bool)
Affect some stationary unselected objects that are under a given point, and consider auto-scrolling.
- pt
- normally the current mouse point, in model coordinates
- moving
- copying
FindDraggablePart() : Part
Return the selectable and movable/copyable Part at the mouse-down point.
Returns: null if there is no selectable Part at the point, or if CanMove and CanCopy are both false.
IsValidLink(Node, Node, Link) : bool
This predicate is called to determine whether a Node may be reconnected by Point).
- fromnode
- tonode
- relink
- the Link to relink to connect the and the
Returns: the result of calling Object) if is null, or if is supplied, the result of calling Object), Object), or Object).
IsValidMember(Group, Node) : bool
This predicate is called to determine whether a Node may be added as a member of the Group by Point).
- group
- this may be null if the node is being added as a top-level node
- node
- a Node, possibly another Group
Returns: the result of calling Object)
MakeDragImage(Rect) : FrameworkElement
Create a representation of the Parts that are being dragged when IsRealtime is false.
- bounds
- The bounds occupied by the DraggedParts, in model coordinates
Returns: FrameworkElement
MayAcceptData(IDataObject) : bool
Decide whether an IDataObject is suitable for copying into this diagram's model.
- dataobj
- An IDataObject, typically the value of DragEventArgs.Data
Returns: By default, this checks whether the dataobject has data in the model's DataFormat or in the model's GetNodeType.
MayCopy() : bool
This predicate is true when the view allows objects to be copied and inserted, and some object in the diagram's selection is copyable, and the user is holding down the Control key.
MayCopyExternal(DragEventArgs) : bool
This predicate is true if the user may copy the selection on an external drag-and-drop.
- e
Returns: False if the AllowedEffects does not allow copy. False if Shift key modifier applies (trying to require a move). False if the diagram IsReadOnly or does not AllowInsert. False if the drag-and-drop started in this control. False if the model is not Modifiable. False if there is no drag-and-drop data of the model's DataFormat. Otherwise true.
MayCopyInternal(DragEventArgs) : bool
This predicate is true if the user may copy the selection on an internal drag-and-drop.
- e
Returns: False if the AllowedEffects does not allow copy. False if Shift key modifier applies (trying to require a move). False if the diagram IsReadOnly or does not AllowInsert. False if the drag-and-drop came from another control. False if the model is not Modifiable. Otherwise true.
MayMove() : bool
This predicate is true when the view allows objects to be moved, and some object in the Selection is movable.
MayMoveExternal(DragEventArgs) : bool
This predicate is true if the user may move the selection on an external drag-and-drop.
- e
Returns: False if the AllowedEffects does not allow move. False if Control key modifier applies (trying to require a copy). False if the diagram IsReadOnly or does not AllowInsert. False if the drag-and-drop started in this control. False if the model is not Modifiable. False if there is no drag-and-drop data of the model's DataFormat. Otherwise true.
MayMoveInternal(DragEventArgs) : bool
This predicate is true if the user may move the selection on an internal drag-and-drop.
- e
Returns: False if the AllowedEffects does not allow move. False if Control key modifier applies (trying to require a copy). False if the diagram IsReadOnly or does not AllowMove. False if the drag-and-drop came from another control. Otherwise true.
MoveParts(Dictionary<Part, Info>, Point)
Move a collection of Parts by a given offset.
- parts
- a Dictionary of parts, mapped to Info values that include the nodes' original locations
- offset
- a Point value in model coordinates
SnapTo(Node, Point, Node, Dictionary<Part, Info>) : Point
Compute the new location for a node, given another node that is controlling its movement.
- moving
- the Node being dragged
- pt
- the Point in model coordinates to which the node is being dragged
- snapper
- the Node, typically a grid, which is controlling the drag snapping
- draggedparts
- a Dictionary of Parts being dragged
Returns: a new node location, in model coordinates
StandardMouseSelect()
Don't have the Control modifier unselect an already selected part.
Fields
CopiesEffectiveCollectionProperty : DependencyProperty
Identifies the CopiesEffectiveCollection dependency property.
DraggableLinksProperty : DependencyProperty
Identifies the DraggableLinks dependency property.
DragOverSnapAreaProperty : DependencyProperty
Identifies the DragOverSnapArea dependency property.
DropOntoEnabledProperty : DependencyProperty
Identifies the DropOntoEnabled dependency property.
FromPortIdProperty : DependencyProperty
Identifies the FromPortId dependency property.
InclusionsProperty : DependencyProperty
Identifies the Inclusions dependency property.
IsRealtimeProperty : DependencyProperty
Identifies the IsRealtime dependency property.
ToPortIdProperty : DependencyProperty
Identifies the ToPortId dependency property.