DiagramEditorControl
Avalonia diagram editor control with toolbar and keyboard shortcuts.
Erbt von: UserControl
Konstruktoren
DiagramEditorControl()
Initializes a new instance of the DiagramEditorControl.
Eigenschaften
Composition : CompositionDiagramElement
The composition element being edited.
Panel : DiagramPanel
The diagram panel.
SelectedElement : DiagramElement
Selected element.
SelectedNodeKey : string
Selected node key.
ShowToolbar : bool
Whether to show the toolbar.
Methoden
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.
Rückgabe: 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).
Rückgabe: 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.
Rückgabe: 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.
Rückgabe: 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.
Rückgabe: 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.
Rückgabe: True if restore was successful.
SaveToString() : string
Save the diagram to a JSON string.
Rückgabe: JSON representation of the diagram.
SelectAll()
Select all elements.
Undo()
Undo the last operation.
Ereignisse
ModelModified : EventHandler
Occurs when the diagram model is modified.
SelectionChanged : EventHandler<DiagramElement>
Occurs when the selected diagram element changes.
Felder
CompositionProperty : StyledProperty<CompositionDiagramElement>
Identifies the Composition dependency property.
IsEditingProperty : StyledProperty<bool>
Identifies the IsEditing dependency property.
ShowToolbarProperty : StyledProperty<bool>
Identifies the ShowToolbar dependency property.