CommandHandler
This class implements the handlers for all of the standard diagram commands.
Inherits: FrameworkElement
Properties
public bool ClipboardBitmap { get; set; }
value = commandHandler.ClipboardBitmap
commandHandler.ClipboardBitmap = value
Gets or sets whether IDataCollection) also adds a bitmap of the area of the selected parts to the system clipboard. [WPF only]
public ICommand CopyCommand { get; }
value = commandHandler.CopyCommand
Gets a non-routed ICommand that executes Copy and is enabled by CanCopy.
public EffectiveCollectionInclusions CopyingInclusions { get; set; }
value = commandHandler.CopyingInclusions
commandHandler.CopyingInclusions = value
Gets or sets whether Copy deletes only the selected parts or subtrees of selected nodes as well.
public ICommand CutCommand { get; }
value = commandHandler.CutCommand
Gets a non-routed ICommand that executes Cut and is enabled by CanCut.
public ICommand DecreaseZoomCommand { get; }
value = commandHandler.DecreaseZoomCommand
Gets a non-routed parameterized ICommand that executes Object) and is enabled by Object).
public ICommand DeleteCommand { get; }
value = commandHandler.DeleteCommand
Gets a non-routed ICommand that executes Delete and is enabled by CanDelete.
public EffectiveCollectionInclusions DeletingInclusions { get; set; }
value = commandHandler.DeletingInclusions
commandHandler.DeletingInclusions = value
Gets or sets whether Delete deletes only the selected parts or subtrees of selected nodes as well.
public Diagram Diagram { get; internal set; }
value = commandHandler.Diagram
commandHandler.Diagram = value
Gets the Diagram for which this CommandHandler executes commands.
public ICommand EditCommand { get; }
value = commandHandler.EditCommand
Gets a non-routed ICommand that executes Edit and is enabled by CanEdit.
public ICommand GroupCommand { get; }
value = commandHandler.GroupCommand
Gets a non-routed ICommand that executes Group and is enabled by CanGroup.
public ICommand IncreaseZoomCommand { get; }
value = commandHandler.IncreaseZoomCommand
Gets a non-routed parameterized ICommand that executes Object) and is enabled by Object).
public ICommand PasteCommand { get; }
value = commandHandler.PasteCommand
Gets a non-routed ICommand that executes Paste and is enabled by CanPaste.
public ICommand PrintCommand { get; }
value = commandHandler.PrintCommand
Gets a non-routed ICommand that executes Print and is enabled by CanPrint.
public object PrototypeGroup { get; set; }
value = commandHandler.PrototypeGroup
commandHandler.PrototypeGroup = value
Gets or sets a data value to be copied for a new group node by Group. In order to enable the Group command, set this property to an instance of a node data object that will be represented by a Group.
public ICommand RedoCommand { get; }
value = commandHandler.RedoCommand
Gets a non-routed ICommand that executes Redo and is enabled by CanRedo.
public ICommand SelectAllCommand { get; }
value = commandHandler.SelectAllCommand
Gets a non-routed ICommand that executes SelectAll and is enabled by CanSelectAll.
public ICommand UndoCommand { get; }
value = commandHandler.UndoCommand
Gets a non-routed ICommand that executes Undo and is enabled by CanUndo.
public ICommand UngroupCommand { get; }
value = commandHandler.UngroupCommand
Gets a non-routed ICommand that executes Ungroup and is enabled by CanUngroup.
public ICommand ZoomCommand { get; }
value = commandHandler.ZoomCommand
Gets a non-routed parameterized ICommand that executes Object) and is enabled by Object).
public double ZoomFactor { get; set; }
value = commandHandler.ZoomFactor
commandHandler.ZoomFactor = value
Gets or sets the factor by which zooming occurs.
public ICommand ZoomToFitCommand { get; }
value = commandHandler.ZoomToFitCommand
Gets a non-routed ICommand that executes ZoomToFit and is enabled by CanZoomToFit.
Methods
public virtual void AddStandardBindings()
commandHandler.AddStandardBindings()
Define the standard CommandBindings and InputBindings for all of the predefined diagram Commands. [WPF only]
public virtual bool CanCopy()
result = commandHandler.CanCopy()
This overridable predicate controls whether or not the Copy command is executed.
Returns: by default, this returns true if AllowCopy is true, if AllowClipboard is true, and if there are some selected parts (SelectedParts).
public virtual bool CanCut()
result = commandHandler.CanCut()
This overridable predicate controls whether or not the Cut command is executed.
Returns: by default, this returns true if the diagram is not IsReadOnly, if AllowCopy is true, if AllowDelete is true, if AllowClipboard is true, if there are some selected parts (SelectedParts), and if the model is Modifiable.
public virtual bool CanDecreaseZoom(object param)
result = commandHandler.CanDecreaseZoom(param)
This overridable predicate controls whether or not the DecreaseZoom command is executed.
- param
- the factor by which to decrease the zoom; this defaults to 5% (1/ZoomFactor)
Returns: by default, this returns true if AllowZoom is true, and if the is a value greater than zero.
public virtual bool CanDelete()
result = commandHandler.CanDelete()
This overridable predicate controls whether or not the Delete command is executed.
Returns: by default, this returns true if the diagram is not IsReadOnly, if AllowDelete is true, and if there are some selected parts (SelectedParts).
public virtual bool CanEdit()
result = commandHandler.CanEdit()
This overridable predicate controls whether or not the Edit command is executed.
Returns: By default, this returns true: if the diagram is not IsReadOnly, if AllowEdit is true, if there are any selected parts that can be CanEdit'ed, and if there is a TextEditingTool.
public virtual bool CanGroup()
result = commandHandler.CanGroup()
This overridable predicate controls whether or not the Group command is executed.
Returns: By default, this returns true: if the PrototypeGroup data is not null, if the diagram is not IsReadOnly, if AllowInsert is true, if AllowGroup is true, if the model is an ISubGraphModel that is modifiable, and if there are any selected nodes that can be CanGroup'ed.
public virtual bool CanIncreaseZoom(object param)
result = commandHandler.CanIncreaseZoom(param)
This overridable predicate controls whether or not the IncreaseZoom command is executed.
- param
- the factor by which to increase the zoom; this defaults to 5% (ZoomFactor)
Returns: by default, this returns true if AllowZoom is true, and if the is a value greater than zero.
public virtual bool CanPaste()
result = commandHandler.CanPaste()
This overridable predicate controls whether or not the Paste command is executed.
Returns: by default, this returns true if the diagram is not IsReadOnly, if AllowInsert is true, if AllowClipboard is true, if the clipboard has data of the format given by the diagram's model's DataFormat, and if the model is Modifiable.
public virtual bool CanPrint()
result = commandHandler.CanPrint()
This overridable predicate controls whether or not the Print command is executed.
Returns: By default, this returns true if AllowPrint is true and there is a PrintManager.
public virtual bool CanRedo()
result = commandHandler.CanRedo()
This overridable predicate controls whether or not the Redo command is executed.
Returns: by default, this returns true if the diagram is not IsReadOnly, if AllowUndo is true, and if the diagram's model's UndoManagerCanRedo predicate returns true.
public virtual bool CanSelectAll()
result = commandHandler.CanSelectAll()
This overridable predicate controls whether or not the SelectAll command is executed.
Returns: by default, this returns true if AllowSelect is true.
public virtual bool CanStopCommand()
result = commandHandler.CanStopCommand()
This overridable predicate controls whether or not the StopCommand is executed.
Returns: by default, this returns true
public virtual bool CanUndo()
result = commandHandler.CanUndo()
This overridable predicate controls whether or not the Undo command is executed.
Returns: by default, this returns true if the diagram is not IsReadOnly, if AllowUndo is true, and if the diagram's model's UndoManagerCanUndo predicate returns true.
public virtual bool CanUngroup()
result = commandHandler.CanUngroup()
This overridable predicate controls whether or not the Ungroup command is executed.
Returns: by default, this returns true if the diagram is not IsReadOnly, if AllowDelete is true, if AllowUngroup is true, if the model is an ISubGraphModel that is modifiable, and if there are any selected Groups that can be CanUngroup'ed.
public virtual bool CanZoom(object param)
result = commandHandler.CanZoom(param)
This overridable predicate controls whether or not the Zoom command is executed.
- param
- the new Scale value; this defaults to 1
Returns: by default, this returns true if AllowZoom is true, and if the is a value greater than zero.
public virtual bool CanZoomToFit()
result = commandHandler.CanZoomToFit()
This overridable predicate controls whether or not the ZoomToFit command is executed.
Returns: by default, this returns true if AllowZoom is true.
public virtual void Copy()
commandHandler.Copy()
Copy the currently SelectedParts from the Diagram into the clipboard.
protected virtual void CopyToClipboard(IDataCollection coll)
commandHandler.CopyToClipboard(coll)
This writes the given data collection to the clipboard using the diagram's model's DataFormat.
- coll
public virtual void DecreaseZoom(object param)
commandHandler.DecreaseZoom(param)
Decrease the Diagram.Panel.Scale by the given factor.
- param
- The factor by which to decrease the zoom. This should be less than one but greater than zero; it defaults to 5% (1/ZoomFactor).
public virtual void Delete()
commandHandler.Delete()
Delete the currently SelectedParts from the Diagram.
public virtual void DoKeyDown(KeyEventArgs e)
commandHandler.DoKeyDown(e)
This is called by the ToolManager.
- e
public virtual void DoKeyUp(KeyEventArgs e)
commandHandler.DoKeyUp(e)
This is called by the ToolManager.
- e
public virtual void Edit()
commandHandler.Edit()
Start in-place editing of the first TextBlock of the selected part.
public virtual void Group()
commandHandler.Group()
Create a new group node and add the selected parts to that new group.
public virtual void IncreaseZoom(object param)
commandHandler.IncreaseZoom(param)
Increase the Diagram.Panel.Scale by the given factor.
- param
- The factor by which to increase the zoom. This should be greater than one; it defaults to 5% (ZoomFactor).
public virtual void Paste()
commandHandler.Paste()
Copy the contents of the clipboard as new nodes and links in this diagram, and make those new parts the new selection.
protected virtual IDataCollection PasteFromClipboard()
result = commandHandler.PasteFromClipboard()
This reads a data collection from the clipboard using the diagram's model's DataFormat.
Returns: null if the Clipboard does not contain any data of the given format
public virtual void Print()
commandHandler.Print()
Print the diagram by showing a PrintDialog and then calling the PrintManager's PrintDialog) method.
protected bool RaiseEvent(RoutedEvent evt)
result = commandHandler.RaiseEvent(evt)
This method just calls UIElement.RaiseEvent on the Diagram and returns whether the event was handled.
- evt
Returns: true if the event was raised and it was Handled
public virtual void RemoveStandardBindings()
commandHandler.RemoveStandardBindings()
Remove all of the standard diagram command bindings and input bindings. [WPF only]
public virtual void SelectAll()
commandHandler.SelectAll()
Select all of the Nodes and Links in the Diagram.
public virtual void StopCommand()
commandHandler.StopCommand()
Cancel the operation of the current CurrentTool.
public virtual void Ungroup()
commandHandler.Ungroup()
For each selected node that is a group, remove the group without removing its members from the diagram.
public virtual void Zoom(object param)
commandHandler.Zoom(param)
Set the Scale property of the Panel to the given value.
- param
- The new scale value. This should be greater than zero; it defaults to 1.
public virtual void ZoomToFit()
commandHandler.ZoomToFit()
Change the Scale such that the whole diagram/document fits into the viewport; or if this command had just executed before, restore the original viewport.
Fields
public static readonly DependencyProperty ClipboardBitmapProperty
value = CommandHandler.ClipboardBitmapProperty
Identifies the ClipboardBitmap dependency property. [WPF only]
public static readonly DependencyProperty CopyingInclusionsProperty
value = CommandHandler.CopyingInclusionsProperty
Identifies the CopyingInclusions dependency property.
public static readonly DependencyProperty DeletingInclusionsProperty
value = CommandHandler.DeletingInclusionsProperty
Identifies the DeletingInclusions dependency property.
public static readonly DependencyProperty PrototypeGroupProperty
value = CommandHandler.PrototypeGroupProperty
Identifies the PrototypeGroup dependency property.
public static readonly DependencyProperty ZoomFactorProperty
value = CommandHandler.ZoomFactorProperty
Identifies the ZoomFactor dependency property.