DiagramPanel

StockSharp.Xaml.Diagram.Avalonia.Controls

Avalonia control that hosts and renders diagram elements.

Inherits: Control

Constructors

DiagramPanel
public DiagramPanel()
diagramPanel = DiagramPanel()

Initializes a new instance of the DiagramPanel.

Properties

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

Whether editing is enabled.

Model
public ICompositionModel Model { get; set; }
value = diagramPanel.Model
diagramPanel.Model = value

The diagram model to display.

PanOffset
public Point PanOffset { get; set; }
value = diagramPanel.PanOffset
diagramPanel.PanOffset = value

Pan offset for scrolling.

SelectedNodeKey
public string SelectedNodeKey { get; set; }
value = diagramPanel.SelectedNodeKey
diagramPanel.SelectedNodeKey = value

Key of the selected node.

SelectedNodeKeys
public IReadOnlySet<string> SelectedNodeKeys { get; }
value = diagramPanel.SelectedNodeKeys

Get all selected node keys.

Zoom
public double Zoom { get; set; }
value = diagramPanel.Zoom
diagramPanel.Zoom = value

Current zoom level.

Methods

AddToSelection
public void AddToSelection(string nodeKey)
diagramPanel.AddToSelection(nodeKey)

Add a node to the selection.

ClearDropTargetHighlight
public void ClearDropTargetHighlight()
diagramPanel.ClearDropTargetHighlight()

Clears any drop target highlighting.

ClearSelection
public void ClearSelection()
diagramPanel.ClearSelection()

Clear all selections.

Copy
public void Copy()
diagramPanel.Copy()

Copy selected nodes to clipboard.

Cut
public void Cut()
diagramPanel.Cut()

Cut selected nodes to clipboard.

DeleteSelected
public void DeleteSelected()
diagramPanel.DeleteSelected()

Delete selected nodes and their connected links.

DiagramToScreen
public Point DiagramToScreen(Point diagram)
result = diagramPanel.DiagramToScreen(diagram)

Converts a diagram coordinate to screen coordinate.

diagram
Diagram coordinate.

Returns: Screen coordinate relative to this control.

FitView
public void FitView()
diagramPanel.FitView()

Fit all nodes into the view.

GetNodeAtPosition
public string GetNodeAtPosition(Point screenPosition)
result = diagramPanel.GetNodeAtPosition(screenPosition)

Gets the node key at the specified screen position, if any.

screenPosition
Screen position to test.

Returns: Node key if found, null otherwise.

HideDragPreview
public void HideDragPreview()
diagramPanel.HideDragPreview()

Hides the drag preview.

HighlightDropTarget
public void HighlightDropTarget(string nodeKey, bool isValid)
diagramPanel.HighlightDropTarget(nodeKey, isValid)

Highlights a node as a potential drop target.

nodeKey
Key of the node to highlight, or null to clear.
isValid
Whether this is a valid drop target.
OnKeyDown
protected override void OnKeyDown(KeyEventArgs e)
diagramPanel.OnKeyDown(e)
OnPointerMoved
protected override void OnPointerMoved(PointerEventArgs e)
diagramPanel.OnPointerMoved(e)
OnPointerPressed
protected override void OnPointerPressed(PointerPressedEventArgs e)
diagramPanel.OnPointerPressed(e)
OnPointerReleased
protected override void OnPointerReleased(PointerReleasedEventArgs e)
diagramPanel.OnPointerReleased(e)
OnPointerWheelChanged
protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
diagramPanel.OnPointerWheelChanged(e)
Paste
public void Paste()
diagramPanel.Paste()

Paste nodes from clipboard.

Render
public override void Render(DrawingContext context)
diagramPanel.Render(context)
ResetView
public void ResetView()
diagramPanel.ResetView()

Reset view to default zoom and position.

ScreenToDiagram
public Point ScreenToDiagram(Point screen)
result = diagramPanel.ScreenToDiagram(screen)

Converts a screen coordinate to diagram coordinate.

screen
Screen coordinate relative to this control.

Returns: Diagram coordinate.

SelectAll
public void SelectAll()
diagramPanel.SelectAll()

Select all nodes.

ShowDragPreview
public void ShowDragPreview(Point screenPosition, string elementName, Color? previewColor)
diagramPanel.ShowDragPreview(screenPosition, elementName, previewColor)

Shows a drag preview ghost at the specified screen position.

screenPosition
Screen position relative to this control.
elementName
Name to display in the preview.
previewColor
Optional custom color for the preview.
UpdateDragPreview
public void UpdateDragPreview(Point screenPosition)
diagramPanel.UpdateDragPreview(screenPosition)

Updates the drag preview position during drag.

screenPosition
New screen position.
ZoomIn
public void ZoomIn()
diagramPanel.ZoomIn()

Zoom in by 25%.

ZoomOut
public void ZoomOut()
diagramPanel.ZoomOut()

Zoom out by 25%.

Events

ModelModified
public event EventHandler ModelModified
diagramPanel.ModelModified += handler

Occurs when the diagram model is modified.

SelectionChanged
public event EventHandler<string> SelectionChanged
diagramPanel.SelectionChanged += handler

Occurs when the selected node changes.

Fields

IsEditingProperty
public static readonly StyledProperty<bool> IsEditingProperty
value = DiagramPanel.IsEditingProperty

Identifies the IsEditing dependency property.

ModelProperty
public static readonly StyledProperty<ICompositionModel> ModelProperty
value = DiagramPanel.ModelProperty

Identifies the Model dependency property.

PanOffsetProperty
public static readonly StyledProperty<Point> PanOffsetProperty
value = DiagramPanel.PanOffsetProperty

Identifies the PanOffset dependency property.

SelectedNodeKeyProperty
public static readonly StyledProperty<string> SelectedNodeKeyProperty
value = DiagramPanel.SelectedNodeKeyProperty

Identifies the SelectedNodeKey dependency property.

ZoomProperty
public static readonly StyledProperty<double> ZoomProperty
value = DiagramPanel.ZoomProperty

Identifies the Zoom dependency property.