DiagramEditorControl

StockSharp.Xaml.Diagram.Avalonia.Controls

Avalonia diagram editor control with toolbar and keyboard shortcuts.

Herda de: UserControl

Construtores

DiagramEditorControl()

Initializes a new instance of the DiagramEditorControl.

Propriedades

CanPaste : bool

Whether paste is available.

CanRedo : bool

Whether redo is available.

CanUndo : bool

Whether undo is available.

Composition : CompositionDiagramElement

The composition element being edited.

IsEditing : bool

Whether editing is enabled.

Panel : DiagramPanel

The diagram panel.

SelectedElement : DiagramElement

Selected element.

SelectedNodeKey : string

Selected node key.

ShowToolbar : bool

Whether to show the toolbar.

Zoom : double

Current zoom level.

Métodos

AddElement(DiagramElement)

Adds an element to the diagram at default position (0, 0).

element
The element to add.
AddElementAt(DiagramElement, double, double)

Adds an element to the diagram at specified position.

element
The element to add.
x
X position on canvas (diagram coordinates).
y
Y position on canvas (diagram coordinates).
ClearDiagram()

Clear all elements from the diagram.

ConnectPalette(DiagramPaletteControl)

Connects a palette control to this editor for drag-drop support.

palette
The palette control to connect.
Copy()

Copy selected elements to clipboard.

Cut()

Cut selected elements to clipboard.

Delete()

Delete selected elements.

DisconnectPalette(DiagramPaletteControl)

Disconnects a palette control from this editor.

palette
The palette control to disconnect.
ExportToImage(string, ExportOptions)

Export the diagram to an image file.

filePath
The output file path.
options
Export options. If null, uses defaults.
ExportToImageBytes(ExportOptions) : byte[]

Export the diagram to a byte array.

options
Export options. If null, uses defaults.

Retorna: The image data as bytes, or null if export failed.

ExportToImageStream(Stream, ExportOptions)

Export the diagram to an image stream.

stream
The output stream.
options
Export options. If null, uses defaults.
HandleDrop(DragEventArgs)

Handle drop event on the panel. Call this from DragOver/Drop events.

HandlePaletteDrop(PaletteItem, Point) : DiagramElement

Handles drag events from a palette control. Call this from the palette's DragStarted event handler.

item
The palette item being dragged.
dropPosition
The position on the panel where the item was dropped (screen coordinates).

Retorna: The created element, or null if creation failed.

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.

Retorna: 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.

Retorna: Diagram file data, or null if invalid.

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Paste()

Paste elements from clipboard.

Redo()

Redo the last undone operation.

RestoreDiagram(DiagramFileData, ElementFactory) : bool

Restore a diagram from file data into the current composition.

data
The file data to restore from.
elementFactory
Optional factory for creating elements by type.

Retorna: True if restore was successful.

RestoreFromFile(string, ElementFactory) : bool

Restore a diagram from a file into the current composition.

filePath
The file path to restore from.
elementFactory
Optional factory for creating elements by type.

Retorna: True if restore was successful.

SaveToFile(string)

Save the diagram to a file.

filePath
The file path to save to.
SaveToStream(Stream)

Save the diagram to a stream.

stream
The stream to write to.
SaveToString() : string

Save the diagram to a JSON string.

Retorna: JSON representation of the diagram.

SelectAll()

Select all elements.

Undo()

Undo the last operation.

Eventos

ModelModified : EventHandler

Occurs when the diagram model is modified.

SelectionChanged : EventHandler<DiagramElement>

Occurs when the selected diagram element changes.

Campos

CompositionProperty : StyledProperty<CompositionDiagramElement>

Identifies the Composition dependency property.

IsEditingProperty : StyledProperty<bool>

Identifies the IsEditing dependency property.

ShowToolbarProperty : StyledProperty<bool>

Identifies the ShowToolbar dependency property.