DiagramViewModel

StockSharp.Xaml.Diagram.Maui

ViewModel for diagram viewer/editor.

Inherits: NotifiableObject

Properties

CanvasSize
public SizeF CanvasSize { get; set; }
value = diagramViewModel.CanvasSize
diagramViewModel.CanvasSize = value

Canvas size, updated from DiagramPage.SizeChanged.

ClearSelectionCommand
public DelegateCommand ClearSelectionCommand { get; }
value = diagramViewModel.ClearSelectionCommand

Gets the command wrapping ClearSelection.

Composition
public CompositionDiagramElement Composition { get; set; }
value = diagramViewModel.Composition
diagramViewModel.Composition = value

Gets or sets the Composition observable property.

CopyCommand
public DelegateCommand CopyCommand { get; }
value = diagramViewModel.CopyCommand

Gets the command wrapping Copy.

CutCommand
public DelegateCommand CutCommand { get; }
value = diagramViewModel.CutCommand

Gets the command wrapping Cut.

DeleteCommand
public DelegateCommand DeleteCommand { get; }
value = diagramViewModel.DeleteCommand

Gets the command wrapping Delete.

Drawable
public DiagramCanvasDrawable Drawable { get; }
value = diagramViewModel.Drawable

The drawable for GraphicsView.

EditorState
public DiagramEditorState EditorState { get; }
value = diagramViewModel.EditorState

Gets the editor state.

ErrorMessage
public string ErrorMessage { get; set; }
value = diagramViewModel.ErrorMessage
diagramViewModel.ErrorMessage = value

Gets or sets the ErrorMessage observable property.

FitToViewCommand
public DelegateCommand FitToViewCommand { get; }
value = diagramViewModel.FitToViewCommand

Gets the command wrapping FitToView.

HasComposition
public bool HasComposition { get; }
value = diagramViewModel.HasComposition

Whether a composition is loaded.

IsDirty
public bool IsDirty { get; set; }
value = diagramViewModel.IsDirty
diagramViewModel.IsDirty = value

Gets or sets the IsDirty observable property.

IsEditing
public bool IsEditing { get; set; }
value = diagramViewModel.IsEditing
diagramViewModel.IsEditing = value

Gets or sets the IsEditing observable property.

PanX
public float PanX { get; set; }
value = diagramViewModel.PanX
diagramViewModel.PanX = value

Gets or sets the PanX observable property.

PanY
public float PanY { get; set; }
value = diagramViewModel.PanY
diagramViewModel.PanY = value

Gets or sets the PanY observable property.

PasteCommand
public DelegateCommand PasteCommand { get; }
value = diagramViewModel.PasteCommand

Gets the command wrapping Paste.

RedoCommand
public DelegateCommand RedoCommand { get; }
value = diagramViewModel.RedoCommand

Gets the command wrapping Redo.

ResetViewCommand
public DelegateCommand ResetViewCommand { get; }
value = diagramViewModel.ResetViewCommand

Gets the command wrapping ResetView.

SelectAllCommand
public DelegateCommand SelectAllCommand { get; }
value = diagramViewModel.SelectAllCommand

Gets the command wrapping SelectAll.

SelectedElement
public DiagramElement SelectedElement { get; set; }
value = diagramViewModel.SelectedElement
diagramViewModel.SelectedElement = value

Gets or sets the SelectedElement observable property.

Selection
public ISelectionModel Selection { get; }
value = diagramViewModel.Selection

Gets the selection model.

Title
public string Title { get; }
value = diagramViewModel.Title

Title for the page.

UndoCommand
public DelegateCommand UndoCommand { get; }
value = diagramViewModel.UndoCommand

Gets the command wrapping Undo.

Zoom
public float Zoom { get; set; }
value = diagramViewModel.Zoom
diagramViewModel.Zoom = value

Gets or sets the Zoom observable property.

ZoomInCommand
public DelegateCommand ZoomInCommand { get; }
value = diagramViewModel.ZoomInCommand

Gets the command wrapping ZoomIn.

ZoomOutCommand
public DelegateCommand ZoomOutCommand { get; }
value = diagramViewModel.ZoomOutCommand

Gets the command wrapping ZoomOut.

Methods

CancelLinkCreation
public void CancelLinkCreation()
diagramViewModel.CancelLinkCreation()

Cancel link creation.

CancelNodeDrag
public void CancelNodeDrag()
diagramViewModel.CancelNodeDrag()

Cancel node drag and restore original position.

CancelPaletteDrag
public void CancelPaletteDrag()
diagramViewModel.CancelPaletteDrag()

Cancel palette drag.

ClearSelection
private void ClearSelection()
diagramViewModel.ClearSelection()

Clear selection.

CompleteLinkCreation
public bool CompleteLinkCreation(SocketKey targetSocketKey)
result = diagramViewModel.CompleteLinkCreation(targetSocketKey)

Complete link creation to target socket.

CompletePaletteDrag
public bool CompletePaletteDrag(float screenX, float screenY)
result = diagramViewModel.CompletePaletteDrag(screenX, screenY)

Complete palette drag and create new node.

ContinueNodeDrag
public void ContinueNodeDrag(float diagramX, float diagramY)
diagramViewModel.ContinueNodeDrag(diagramX, diagramY)

Continue dragging a node or multiple nodes.

Copy
private void Copy()
diagramViewModel.Copy()

Copy selected elements to clipboard.

Cut
private void Cut()
diagramViewModel.Cut()

Cut selected elements to clipboard.

Delete
private void Delete()
diagramViewModel.Delete()

Delete selected elements.

EndNodeDrag
public void EndNodeDrag()
diagramViewModel.EndNodeDrag()

End node drag.

FitToView
private void FitToView()
diagramViewModel.FitToView()

Fit diagram to view.

GetCompatibleSockets
public IEnumerable<SocketKey> GetCompatibleSockets()
result = diagramViewModel.GetCompatibleSockets()

Get all compatible sockets for the current link source.

Invalidate
public void Invalidate()
diagramViewModel.Invalidate()

Request canvas redraw.

LoadFromFile
public static DiagramFileData LoadFromFile(string filePath)
result = DiagramViewModel.LoadFromFile(filePath)

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.

Returns: Diagram file data, or null if invalid.

LoadFromStream
public static DiagramFileData LoadFromStream(Stream stream)
result = DiagramViewModel.LoadFromStream(stream)

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.

Returns: Diagram file data, or null if invalid.

NotifyClipboardChanged
public void NotifyClipboardChanged()
diagramViewModel.NotifyClipboardChanged()

Notify clipboard command state changes.

NotifyUndoRedoChanged
public void NotifyUndoRedoChanged()
diagramViewModel.NotifyUndoRedoChanged()

Notify that undo/redo state may have changed.

OnPan
public void OnPan(float deltaX, float deltaY)
diagramViewModel.OnPan(deltaX, deltaY)

Handle pan gesture delta.

OnPinch
public void OnPinch(float scale, float focusX, float focusY)
diagramViewModel.OnPinch(scale, focusX, focusY)

Handle pinch gesture.

OnTap
public void OnTap(float screenX, float screenY)
diagramViewModel.OnTap(screenX, screenY)

Handle tap at screen coordinates.

OnTapWithModifier
public void OnTapWithModifier(float screenX, float screenY, bool addToSelection)
diagramViewModel.OnTapWithModifier(screenX, screenY, addToSelection)

Handle tap with modifier for multi-select.

Paste
private void Paste()
diagramViewModel.Paste()

Paste elements from clipboard.

Redo
private void Redo()
diagramViewModel.Redo()

Redo the last undone action.

ResetView
private void ResetView()
diagramViewModel.ResetView()

Reset zoom and pan to default.

SaveToFile
public void SaveToFile(string filePath)
diagramViewModel.SaveToFile(filePath)

Save the diagram to a file.

filePath
The file path to save to.
SaveToStream
public void SaveToStream(Stream stream)
diagramViewModel.SaveToStream(stream)

Save the diagram to a stream.

stream
The stream to write to.
SaveToString
public string SaveToString()
result = diagramViewModel.SaveToString()

Save the diagram to a JSON string.

Returns: JSON representation of the diagram.

SelectAll
private void SelectAll()
diagramViewModel.SelectAll()

Select all elements.

SelectNodesInRect
public void SelectNodesInRect(RectF screenRect)
diagramViewModel.SelectNodesInRect(screenRect)

Select all nodes within a screen-space rectangle (rubber band selection).

SetInvalidateCallback
public void SetInvalidateCallback(Action invalidate)
diagramViewModel.SetInvalidateCallback(invalidate)

Set the canvas invalidation callback.

StartLinkCreation
public void StartLinkCreation(SocketKey socketKey, float screenX, float screenY)
diagramViewModel.StartLinkCreation(socketKey, screenX, screenY)

Start creating a link from a socket.

StartNodeDrag
public void StartNodeDrag(string nodeKey, float diagramX, float diagramY)
diagramViewModel.StartNodeDrag(nodeKey, diagramX, diagramY)

Start dragging a node (or multiple if the node is in a multi-selection).

StartPaletteDrag
public void StartPaletteDrag(PaletteItem item, float screenX, float screenY)
diagramViewModel.StartPaletteDrag(item, screenX, screenY)

Start dragging an element from the palette.

TryCreateElement
private bool TryCreateElement(PaletteItem item, float x, float y)
result = diagramViewModel.TryCreateElement(item, x, y)

Try to create a new element at the specified position.

Undo
private void Undo()
diagramViewModel.Undo()

Undo the last action.

UpdateLinkCreation
public void UpdateLinkCreation(float screenX, float screenY)
diagramViewModel.UpdateLinkCreation(screenX, screenY)

Update link creation endpoint.

UpdateLinkHover
public void UpdateLinkHover(SocketKey hoverSocket)
diagramViewModel.UpdateLinkHover(hoverSocket)

Update link hover validation state.

UpdatePaletteDrag
public void UpdatePaletteDrag(float screenX, float screenY, bool isOverCanvas)
diagramViewModel.UpdatePaletteDrag(screenX, screenY, isOverCanvas)

Update palette drag position.

WouldCreateCycle
private bool WouldCreateCycle(string fromNodeKey, string toNodeKey)
result = diagramViewModel.WouldCreateCycle(fromNodeKey, toNodeKey)

Check if adding a link would create a cycle in the graph.

ZoomIn
private void ZoomIn()
diagramViewModel.ZoomIn()

Zoom in by 25%.

ZoomOut
private void ZoomOut()
diagramViewModel.ZoomOut()

Zoom out by 25%.