DiagramViewModel
ViewModel for diagram viewer/editor.
继承自: NotifiableObject
属性
CanvasSize : SizeF
Canvas size, updated from DiagramPage.SizeChanged.
ClearSelectionCommand : DelegateCommand
Gets the command wrapping ClearSelection.
Composition : CompositionDiagramElement
Gets or sets the Composition observable property.
CopyCommand : DelegateCommand
Gets the command wrapping Copy.
CutCommand : DelegateCommand
Gets the command wrapping Cut.
DeleteCommand : DelegateCommand
Gets the command wrapping Delete.
Drawable : DiagramCanvasDrawable
The drawable for GraphicsView.
EditorState : DiagramEditorState
Gets the editor state.
ErrorMessage : string
Gets or sets the ErrorMessage observable property.
FitToViewCommand : DelegateCommand
Gets the command wrapping FitToView.
HasComposition : bool
Whether a composition is loaded.
PasteCommand : DelegateCommand
Gets the command wrapping Paste.
RedoCommand : DelegateCommand
Gets the command wrapping Redo.
ResetViewCommand : DelegateCommand
Gets the command wrapping ResetView.
SelectAllCommand : DelegateCommand
Gets the command wrapping SelectAll.
SelectedElement : DiagramElement
Gets or sets the SelectedElement observable property.
Selection : ISelectionModel
Gets the selection model.
UndoCommand : DelegateCommand
Gets the command wrapping Undo.
ZoomInCommand : DelegateCommand
Gets the command wrapping ZoomIn.
ZoomOutCommand : DelegateCommand
Gets the command wrapping ZoomOut.
方法
CancelLinkCreation()
Cancel link creation.
CancelNodeDrag()
Cancel node drag and restore original position.
CancelPaletteDrag()
Cancel palette drag.
ClearSelection()
Clear selection.
CompleteLinkCreation(SocketKey) : bool
Complete link creation to target socket.
CompletePaletteDrag(float, float) : bool
Complete palette drag and create new node.
ContinueNodeDrag(float, float)
Continue dragging a node or multiple nodes.
Copy()
Copy selected elements to clipboard.
Cut()
Cut selected elements to clipboard.
Delete()
Delete selected elements.
DeleteLink(string, string, string, string)
Delete a link between two sockets.
EndNodeDrag()
End node drag.
FitToView()
Fit diagram to view.
GetCompatibleSockets() : IEnumerable<SocketKey>
Get all compatible sockets for the current link source.
Invalidate()
Request canvas redraw.
LoadFromFile(string) : DiagramFileData
Load diagram data from a file. Note: This only returns the data structure. Use composition loading for full restore.
- filePath
- The file path to load from.
返回值: Diagram file data, or null if invalid.
LoadFromStream(Stream) : DiagramFileData
Load diagram data from a stream. Note: This only returns the data structure. Use composition loading for full restore.
- stream
- The stream to read from.
返回值: Diagram file data, or null if invalid.
NotifyClipboardChanged()
Notify clipboard command state changes.
NotifyUndoRedoChanged()
Notify that undo/redo state may have changed.
OnTapWithModifier(float, float, bool)
Handle tap with modifier for multi-select.
Paste()
Paste elements from clipboard.
Redo()
Redo the last undone action.
ResetView()
Reset zoom and pan to default.
SelectAll()
Select all elements.
SelectNodesInRect(RectF)
Select all nodes within a screen-space rectangle (rubber band selection).
SetInvalidateCallback(Action)
Set the canvas invalidation callback.
StartLinkCreation(SocketKey, float, float)
Start creating a link from a socket.
StartNodeDrag(string, float, float)
Start dragging a node (or multiple if the node is in a multi-selection).
StartPaletteDrag(PaletteItem, float, float)
Start dragging an element from the palette.
TryCreateElement(PaletteItem, float, float) : bool
Try to create a new element at the specified position.
Undo()
Undo the last action.
UpdateLinkCreation(float, float)
Update link creation endpoint.
UpdateLinkHover(SocketKey)
Update link hover validation state.
UpdatePaletteDrag(float, float, bool)
Update palette drag position.
ValidateLink(SocketKey, SocketKey, string) : bool
Validate if a link can be created between two sockets.
- source
- Source socket.
- target
- Target socket.
- error
- Error message if invalid.
返回值: True if link is valid.
WouldCreateCycle(string, string) : bool
Check if adding a link would create a cycle in the graph.
ZoomIn()
Zoom in by 25%.
ZoomOut()
Zoom out by 25%.