DiagramEditorControl

StockSharp.Xaml.Diagram.Controls

Avalonia diagram editor control with toolbar and keyboard shortcuts.

Hereda de: UserControl

Implementa: IAsyncPersistable, IUndoRedoManager, IDisposable

Constructores

DiagramEditorControl
public DiagramEditorControl()
diagramEditorControl = DiagramEditorControl()

Initializes a new instance of the DiagramEditorControl.

Propiedades

CanPaste
public bool CanPaste { get; }
value = diagramEditorControl.CanPaste

Gets whether canonical diagram data is available for paste.

CanRedo
public bool CanRedo { get; }
value = diagramEditorControl.CanRedo

Gets whether redo is available.

CanUndo
public bool CanUndo { get; }
value = diagramEditorControl.CanUndo

Gets whether undo is available.

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

The composition element being edited.

DoubleClickHandlers
public IDictionary<Type, IDoubleClickHandler> DoubleClickHandlers { get; }
value = diagramEditorControl.DoubleClickHandlers

Gets the element-specific double-click handlers.

DrawnModel
internal ICompositionModel DrawnModel { get; }
value = diagramEditorControl.DrawnModel

The graph the surface is drawing, or when it draws nothing.

HelpCommand
public ICommand HelpCommand { get; set; }
value = diagramEditorControl.HelpCommand
diagramEditorControl.HelpCommand = value

Gets or sets the host command that opens element help.

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

Whether editing is enabled.

IsEncrypted
public bool IsEncrypted { get; set; }
value = diagramEditorControl.IsEncrypted
diagramEditorControl.IsEncrypted = value

Gets or sets whether the encrypted-content overlay is visible.

IsReadOnly
public bool IsReadOnly { get; set; }
value = diagramEditorControl.IsReadOnly
diagramEditorControl.IsReadOnly = value

Gets or sets whether model mutations are disabled.

OpenElementCommand
public ICommand OpenElementCommand { get; set; }
value = diagramEditorControl.OpenElementCommand
diagramEditorControl.OpenElementCommand = value

Gets or sets the host command that opens the selected element.

OpenPropertiesCommand
public ICommand OpenPropertiesCommand { get; set; }
value = diagramEditorControl.OpenPropertiesCommand
diagramEditorControl.OpenPropertiesCommand = value

Gets or sets the host command that opens element properties.

PaletteItemDataFormat
public static DataFormat<PaletteItem> PaletteItemDataFormat { get; }
value = DiagramEditorControl.PaletteItemDataFormat

Gets the in-process drag-and-drop format used for palette items.

Panel
public DiagramPanel Panel { get; }
value = diagramEditorControl.Panel

Gets the diagram panel compatibility facade.

RedoCommand
public ICommand RedoCommand { get; set; }
value = diagramEditorControl.RedoCommand
diagramEditorControl.RedoCommand = value

Gets or sets the redo command.

Registry
public ICompositionRegistry Registry { get; set; }
value = diagramEditorControl.Registry
diagramEditorControl.Registry = value

Gets or sets the registry used for canonical serialization and clipboard operations.

RemoveCommand
public ICommand RemoveCommand { get; set; }
value = diagramEditorControl.RemoveCommand
diagramEditorControl.RemoveCommand = value

Gets or sets the command that removes the context object.

Scale
public double Scale { get; set; }
value = diagramEditorControl.Scale
diagramEditorControl.Scale = value

Gets or sets the viewport scale.

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

Gets or sets the primary selected element.

SelectedElements
public IReadOnlyList<DiagramElement> SelectedElements { get; set; }
value = diagramEditorControl.SelectedElements
diagramEditorControl.SelectedElements = value

Gets or sets the selected elements.

SelectedNodeKey
public string SelectedNodeKey { get; }
value = diagramEditorControl.SelectedNodeKey

Gets the selected node key.

ShowGrid
public bool ShowGrid { get; set; }
value = diagramEditorControl.ShowGrid
diagramEditorControl.ShowGrid = value

Gets or sets whether the diagram grid is visible.

ShowOverview
public bool ShowOverview { get; set; }
value = diagramEditorControl.ShowOverview
diagramEditorControl.ShowOverview = value

Gets or sets whether the diagram overview is visible.

ShowToolbar
public bool ShowToolbar { get; set; }
value = diagramEditorControl.ShowToolbar
diagramEditorControl.ShowToolbar = value

Whether to show the toolbar.

SnapToGrid
public bool SnapToGrid { get; set; }
value = diagramEditorControl.SnapToGrid
diagramEditorControl.SnapToGrid = value

Gets or sets whether moves snap to the grid.

UndoCommand
public ICommand UndoCommand { get; set; }
value = diagramEditorControl.UndoCommand
diagramEditorControl.UndoCommand = value

Gets or sets the undo command.

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

Gets or sets the current zoom level.

Métodos

AddElement
public void AddElement(DiagramElement element)
diagramEditorControl.AddElement(element)

Adds an element at the default diagram position.

element
Element.
AddElementAt
public void AddElementAt(DiagramElement element, double x, double y)
diagramEditorControl.AddElementAt(element, x, y)

Adds an element at the specified diagram position.

element
Element.
x
Diagram X coordinate.
y
Diagram Y coordinate.
ApplyModel
private void ApplyModel()
diagramEditorControl.ApplyModel()

Hands the panel the graph to draw. Composition can become null (e.g. switching to a code configuration, or panel teardown); the panel renders nothing for a null model. An encrypted schema is withheld as well - the overlay says it cannot be shown, and drawing it underneath would be showing what the overlay says is hidden.

CanAcceptPaletteDrop
public bool CanAcceptPaletteDrop(PaletteItem item)
result = diagramEditorControl.CanAcceptPaletteDrop(item)

Gets whether an item can currently be dropped into the editor.

item
Palette item.

Devuelve: when the item represents an element and the model is editable.

ClearDiagram
public void ClearDiagram()
diagramEditorControl.ClearDiagram()

Clears all nodes and connected links.

ClearSelection
public void ClearSelection()
diagramEditorControl.ClearSelection()

Clears node and socket selection.

ConnectPalette
public void ConnectPalette(DiagramPaletteControl palette)
diagramEditorControl.ConnectPalette(palette)

Connects a palette to this editor.

palette
Palette control.
CopyAsync
public Task CopyAsync(CancellationToken cancellationToken)
result = diagramEditorControl.CopyAsync(cancellationToken)

Copies selected elements to the system clipboard.

cancellationToken
CancellationToken

Devuelve: Task

CutAsync
public Task CutAsync(CancellationToken cancellationToken)
result = diagramEditorControl.CutAsync(cancellationToken)

Cuts selected elements to the system clipboard.

cancellationToken
CancellationToken

Devuelve: Task

Delete
public void Delete()
diagramEditorControl.Delete()

Deletes selected elements.

DisconnectPalette
public void DisconnectPalette(DiagramPaletteControl palette)
diagramEditorControl.DisconnectPalette(palette)

Disconnects a palette from this editor.

palette
Palette control.
Dispose
public void Dispose()
diagramEditorControl.Dispose()

Disposes of items in the pool that implement IDisposable.

ExportToImage
public void ExportToImage(string filePath, DiagramImageExportOptions options)
diagramEditorControl.ExportToImage(filePath, options)

Exports the diagram to an image file.

filePath
Output file path.
options
Export options.
ExportToImageBytes
public byte[] ExportToImageBytes(DiagramImageExportOptions options)
result = diagramEditorControl.ExportToImageBytes(options)

Exports the diagram to a byte array.

options
Export options.

Devuelve: PNG image data, or when no model is loaded.

ExportToImageStream
public void ExportToImageStream(Stream stream, DiagramImageExportOptions options)
diagramEditorControl.ExportToImageStream(stream, options)

Exports the diagram to an image stream.

stream
Output stream.
options
Export options.
FitToView
public void FitToView()
diagramEditorControl.FitToView()

Fits every cube into the current viewport.

GetSelectionCopyElementAsync
public Task<CompositionDiagramElement> GetSelectionCopyElementAsync(CancellationToken cancellationToken)
result = diagramEditorControl.GetSelectionCopyElementAsync(cancellationToken)

Creates a detached composition containing the selected elements and their internal links.

cancellationToken
CancellationToken

Devuelve: The selected composition fragment, or when no registry or composition is available.

HandleDropAsync
public Task HandleDropAsync(DragEventArgs e, CancellationToken cancellationToken)
result = diagramEditorControl.HandleDropAsync(e, cancellationToken)

Handles a native Avalonia drop event.

e
Drop event.
cancellationToken
CancellationToken

Devuelve: Task

HandlePaletteDropAsync
public Task<DiagramElement> HandlePaletteDropAsync(PaletteItem item, Point dropPosition, CancellationToken cancellationToken)
result = diagramEditorControl.HandlePaletteDropAsync(item, dropPosition, cancellationToken)

Creates a palette element at the supplied panel position.

item
Palette item.
dropPosition
Panel-space drop position.
cancellationToken
CancellationToken

Devuelve: Created element, or .

LoadAsync
public Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = diagramEditorControl.LoadAsync(storage, cancellationToken)

Asynchronously loads the state of the object from the specified SettingsStorage.

storage
The SettingsStorage instance from which to load the data.
cancellationToken
A token to monitor for cancellation requests.

Devuelve: A task that represents the asynchronous load operation.

OnPropertyChanged
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
diagramEditorControl.OnPropertyChanged(change)
PasteAsync
public Task PasteAsync(CancellationToken cancellationToken)
result = diagramEditorControl.PasteAsync(cancellationToken)

Pastes elements from the system clipboard.

cancellationToken
CancellationToken

Devuelve: Task

ProcessElementDoubleClickAsync
public Task ProcessElementDoubleClickAsync(DiagramElement element)
result = diagramEditorControl.ProcessElementDoubleClickAsync(element)

Processes a diagram element double click through its specialized or host handler.

element
The activated element.

Devuelve: Task

Redo
public void Redo()
diagramEditorControl.Redo()

Redoes the last undone diagram operation.

ResetView
public void ResetView()
diagramEditorControl.ResetView()

Restores the default scale and centers the diagram.

RestoreFromFileAsync
public Task<bool> RestoreFromFileAsync(string filePath, CancellationToken cancellationToken)
result = diagramEditorControl.RestoreFromFileAsync(filePath, cancellationToken)

Restores a canonical file into the current composition.

filePath
Source file.
cancellationToken
CancellationToken

Devuelve: when restore succeeds.

RestoreFromStreamAsync
public Task<bool> RestoreFromStreamAsync(Stream stream, CancellationToken cancellationToken)
result = diagramEditorControl.RestoreFromStreamAsync(stream, cancellationToken)

Restores a canonical stream into the current composition.

stream
Source stream.
cancellationToken
CancellationToken

Devuelve: when restore succeeds.

RestoreFromStringAsync
public Task<bool> RestoreFromStringAsync(string text, CancellationToken cancellationToken)
result = diagramEditorControl.RestoreFromStringAsync(text, cancellationToken)

Restores canonical diagram text into the current composition.

text
Canonical serialized diagram.
cancellationToken
CancellationToken

Devuelve: when restore succeeds.

SaveAsync
public Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = diagramEditorControl.SaveAsync(storage, cancellationToken)

Asynchronously saves the state of the object to the specified SettingsStorage.

storage
The SettingsStorage instance to which to save the data.
cancellationToken
A token to monitor for cancellation requests.

Devuelve: A task that represents the asynchronous save operation.

SaveToFileAsync
public Task SaveToFileAsync(string filePath, CancellationToken cancellationToken)
result = diagramEditorControl.SaveToFileAsync(filePath, cancellationToken)

Saves the diagram to a canonical registry file.

filePath
Destination file.
cancellationToken
CancellationToken

Devuelve: Task

SaveToImage
public void SaveToImage(string filePath, DiagramImageExportOptions options)
diagramEditorControl.SaveToImage(filePath, options)

Saves the production diagram presenter tree to a PNG file.

filePath
Destination file.
options
Export options.
SaveToImage
public void SaveToImage(Stream stream)
diagramEditorControl.SaveToImage(stream)

Saves the production diagram presenter tree to a PNG stream.

stream
Destination stream.
SaveToStreamAsync
public Task SaveToStreamAsync(Stream stream, CancellationToken cancellationToken)
result = diagramEditorControl.SaveToStreamAsync(stream, cancellationToken)

Saves the diagram to a stream without closing it.

stream
Destination stream.
cancellationToken
CancellationToken

Devuelve: Task

SaveToStringAsync
public Task<string> SaveToStringAsync(CancellationToken cancellationToken)
result = diagramEditorControl.SaveToStringAsync(cancellationToken)

Saves the diagram to the canonical registry text format.

cancellationToken
CancellationToken

Devuelve: Canonical serialized diagram.

Select
public void Select(DiagramElement element)
diagramEditorControl.Select(element)

Selects one element and clears the previous selection.

element
Element to select, or to clear selection.
SelectAll
public void SelectAll()
diagramEditorControl.SelectAll()

Selects all elements.

Undo
public void Undo()
diagramEditorControl.Undo()

Undoes the last diagram operation.

Eventos

ContextMenuBuilding
public event EventHandler<DiagramContextMenuBuildingEventArgs> ContextMenuBuilding
diagramEditorControl.ContextMenuBuilding += handler

Occurs before a diagram context menu opens and lets the host append items.

ElementDoubleClicked
public event EventHandler<DiagramElement> ElementDoubleClicked
diagramEditorControl.ElementDoubleClicked += handler

Occurs when a diagram element is double-clicked.

HelpRequested
public event EventHandler<DiagramElement> HelpRequested
diagramEditorControl.HelpRequested += handler

Occurs when the default help command is invoked.

ModelModified
public event EventHandler ModelModified
diagramEditorControl.ModelModified += handler

Occurs when the diagram model is modified.

OperationFailed
public event EventHandler<DiagramOperationFailedEventArgs> OperationFailed
diagramEditorControl.OperationFailed += handler

Occurs when a diagram operation cannot complete its platform-side work.

PropertiesRequested
public event EventHandler<DiagramElement> PropertiesRequested
diagramEditorControl.PropertiesRequested += handler

Occurs when the default properties command is invoked.

SelectionChanged
public event EventHandler<DiagramElement> SelectionChanged
diagramEditorControl.SelectionChanged += handler

Occurs when the selected diagram element changes.

SocketClicked
public event EventHandler<DiagramSocketClickedEventArgs> SocketClicked
diagramEditorControl.SocketClicked += handler

Occurs when a diagram socket is activated.

Campos

CompositionProperty
public static readonly StyledProperty<CompositionDiagramElement> CompositionProperty
value = DiagramEditorControl.CompositionProperty

Identifies the Composition dependency property.

HelpCommandProperty
public static readonly StyledProperty<ICommand> HelpCommandProperty
value = DiagramEditorControl.HelpCommandProperty

Identifies the HelpCommand styled property.

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

Identifies the IsEditing dependency property.

IsEncryptedProperty
public static readonly StyledProperty<bool> IsEncryptedProperty
value = DiagramEditorControl.IsEncryptedProperty

Identifies the IsEncrypted styled property.

IsReadOnlyProperty
public static readonly StyledProperty<bool> IsReadOnlyProperty
value = DiagramEditorControl.IsReadOnlyProperty

Identifies the IsReadOnly styled property.

OpenElementCommandProperty
public static readonly StyledProperty<ICommand> OpenElementCommandProperty
value = DiagramEditorControl.OpenElementCommandProperty

Identifies the OpenElementCommand styled property.

OpenPropertiesCommandProperty
public static readonly StyledProperty<ICommand> OpenPropertiesCommandProperty
value = DiagramEditorControl.OpenPropertiesCommandProperty

Identifies the OpenPropertiesCommand styled property.

RedoCommandProperty
public static readonly StyledProperty<ICommand> RedoCommandProperty
value = DiagramEditorControl.RedoCommandProperty

Identifies the RedoCommand styled property.

RegistryProperty
public static readonly StyledProperty<ICompositionRegistry> RegistryProperty
value = DiagramEditorControl.RegistryProperty

Identifies the Registry styled property.

RemoveCommandProperty
public static readonly StyledProperty<ICommand> RemoveCommandProperty
value = DiagramEditorControl.RemoveCommandProperty

Identifies the RemoveCommand styled property.

ScaleProperty
public static readonly StyledProperty<double> ScaleProperty
value = DiagramEditorControl.ScaleProperty

Identifies the Scale styled property.

SelectedElementProperty
public static readonly StyledProperty<DiagramElement> SelectedElementProperty
value = DiagramEditorControl.SelectedElementProperty

Identifies the SelectedElement styled property.

SelectedElementsProperty
public static readonly StyledProperty<IReadOnlyList<DiagramElement>> SelectedElementsProperty
value = DiagramEditorControl.SelectedElementsProperty

Identifies the SelectedElements styled property.

ShowGridProperty
public static readonly StyledProperty<bool> ShowGridProperty
value = DiagramEditorControl.ShowGridProperty

Identifies the ShowGrid styled property.

ShowOverviewProperty
public static readonly StyledProperty<bool> ShowOverviewProperty
value = DiagramEditorControl.ShowOverviewProperty

Identifies the ShowOverview styled property.

ShowToolbarProperty
public static readonly StyledProperty<bool> ShowToolbarProperty
value = DiagramEditorControl.ShowToolbarProperty

Identifies the ShowToolbar dependency property.

SnapToGridProperty
public static readonly StyledProperty<bool> SnapToGridProperty
value = DiagramEditorControl.SnapToGridProperty

Identifies the SnapToGrid styled property.

UndoCommandProperty
public static readonly StyledProperty<ICommand> UndoCommandProperty
value = DiagramEditorControl.UndoCommandProperty

Identifies the UndoCommand styled property.