Class GraphCanvas

Inheritance
AvaloniaObject
Animatable
StyledElement
Visual
Layoutable
Interactive
InputElement
Control
TemplatedControl
ContentControl
UserControl
GraphCanvas
Implements
IAvaloniaObjectDebug
IDataContextProvider
ILogical
IThemeVariantHost
IResourceHost
IResourceNode
IStyleHost
ISetLogicalParent
ISetInheritanceParent
INamed
IAvaloniaListItemValidator<ILogical>
IAvaloniaListItemValidator<Visual>
IInputElement
IDataTemplateHost
IVisualBrushInitialize
ISetterValue
IContentControl
IContentPresenterHost
Inherited Members
UserControl.OnCreateAutomationPeer()
ContentControl.ContentProperty
ContentControl.ContentTemplateProperty
ContentControl.HorizontalContentAlignmentProperty
ContentControl.VerticalContentAlignmentProperty
ContentControl.IContentPresenterHost.RegisterContentPresenter(ContentPresenter)
ContentControl.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
ContentControl.RegisterContentPresenter(ContentPresenter)
ContentControl.Content
ContentControl.ContentTemplate
ContentControl.Presenter
ContentControl.HorizontalContentAlignment
ContentControl.VerticalContentAlignment
ContentControl.IContentPresenterHost.LogicalChildren
TemplatedControl.BackgroundProperty
TemplatedControl.BackgroundSizingProperty
TemplatedControl.BorderBrushProperty
TemplatedControl.BorderThicknessProperty
TemplatedControl.CornerRadiusProperty
TemplatedControl.FontFamilyProperty
TemplatedControl.FontFeaturesProperty
TemplatedControl.FontSizeProperty
TemplatedControl.FontStyleProperty
TemplatedControl.FontWeightProperty
TemplatedControl.FontStretchProperty
TemplatedControl.ForegroundProperty
TemplatedControl.LetterSpacingProperty
TemplatedControl.PaddingProperty
TemplatedControl.TemplateProperty
TemplatedControl.IsTemplateFocusTargetProperty
TemplatedControl.TemplateAppliedEvent
TemplatedControl.GetIsTemplateFocusTarget(Control)
TemplatedControl.ApplyTemplate()
TemplatedControl.GetTemplateFocusTarget()
TemplatedControl.NotifyChildResourcesChanged(ResourcesChangedEventArgs)
TemplatedControl.OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)
TemplatedControl.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)
TemplatedControl.OnApplyTemplate(TemplateAppliedEventArgs)
TemplatedControl.OnTemplateChanged(AvaloniaPropertyChangedEventArgs)
TemplatedControl.OnControlThemeChanged()
TemplatedControl.Background
TemplatedControl.BackgroundSizing
TemplatedControl.BorderBrush
TemplatedControl.BorderThickness
TemplatedControl.CornerRadius
TemplatedControl.FontFamily
TemplatedControl.FontFeatures
TemplatedControl.FontSize
TemplatedControl.FontStyle
TemplatedControl.FontWeight
TemplatedControl.FontStretch
TemplatedControl.Foreground
TemplatedControl.LetterSpacing
TemplatedControl.Padding
TemplatedControl.Template
TemplatedControl.TemplateApplied
Control.FocusAdornerProperty
Control.TagProperty
Control.ContextMenuProperty
Control.ContextFlyoutProperty
Control.RequestBringIntoViewEvent
Control.LoadedEvent
Control.UnloadedEvent
Control.SizeChangedEvent
Control.ISetterValue.Initialize(SetterBase)
Control.IVisualBrushInitialize.EnsureInitialized()
Control.OnLoaded(RoutedEventArgs)
Control.OnUnloaded(RoutedEventArgs)
Control.OnSizeChanged(SizeChangedEventArgs)
Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)
Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)
Control.OnGotFocus(FocusChangedEventArgs)
Control.OnLostFocus(FocusChangedEventArgs)
Control.OnPointerReleased(PointerReleasedEventArgs)
Control.OnKeyUp(KeyEventArgs)
Control.FocusAdorner
Control.DataTemplates
Control.ContextMenu
Control.ContextFlyout
Control.IsLoaded
Control.Tag
Control.IDataTemplateHost.IsDataTemplatesInitialized
Control.Loaded
Control.Unloaded
Control.SizeChanged
InputElement.FocusableProperty
InputElement.IsEnabledProperty
InputElement.IsEffectivelyEnabledProperty
InputElement.CursorProperty
InputElement.IsKeyboardFocusWithinProperty
InputElement.IsFocusedProperty
InputElement.IsHitTestVisibleProperty
InputElement.IsPointerOverProperty
InputElement.IsTabStopProperty
InputElement.GotFocusEvent
InputElement.GettingFocusEvent
InputElement.LostFocusEvent
InputElement.LosingFocusEvent
InputElement.KeyDownEvent
InputElement.KeyUpEvent
InputElement.TabIndexProperty
InputElement.TextInputEvent
InputElement.TextInputMethodClientRequestedEvent
InputElement.PointerEnteredEvent
InputElement.PointerExitedEvent
InputElement.PointerMovedEvent
InputElement.PointerPressedEvent
InputElement.PointerReleasedEvent
InputElement.PointerCaptureLostEvent
InputElement.PointerWheelChangedEvent
InputElement.ContextRequestedEvent
InputElement.ContextCanceledEvent
InputElement.IsHoldingEnabledProperty
InputElement.IsHoldWithMouseEnabledProperty
InputElement.PinchEvent
InputElement.PinchEndedEvent
InputElement.PullGestureEvent
InputElement.PullGestureEndedEvent
InputElement.SwipeGestureEvent
InputElement.SwipeGestureEndedEvent
InputElement.ScrollGestureEvent
InputElement.ScrollGestureInertiaStartingEvent
InputElement.ScrollGestureEndedEvent
InputElement.PointerTouchPadGestureMagnifyEvent
InputElement.PointerTouchPadGestureRotateEvent
InputElement.PointerTouchPadGestureSwipeEvent
InputElement.TappedEvent
InputElement.RightTappedEvent
InputElement.HoldingEvent
InputElement.DoubleTappedEvent
InputElement.Focus(NavigationMethod, KeyModifiers)
InputElement.OnAccessKey(RoutedEventArgs)
InputElement.OnGettingFocus(FocusChangingEventArgs)
InputElement.OnLosingFocus(FocusChangingEventArgs)
InputElement.OnKeyDown(KeyEventArgs)
InputElement.OnTextInput(TextInputEventArgs)
InputElement.OnPointerEntered(PointerEventArgs)
InputElement.OnPointerExited(PointerEventArgs)
InputElement.OnPointerMoved(PointerEventArgs)
InputElement.OnPointerPressed(PointerPressedEventArgs)
InputElement.GetNextTabStopOverride()
InputElement.GetPreviousTabStopOverride()
InputElement.GetFirstFocusableElementOverride()
InputElement.GetLastFocusableElementOverride()
InputElement.OnPointerCaptureChanging(PointerCaptureChangingEventArgs)
InputElement.OnPointerCaptureLost(PointerCaptureLostEventArgs)
InputElement.OnPointerWheelChanged(PointerWheelEventArgs)
InputElement.OnTapped(TappedEventArgs)
InputElement.OnRightTapped(TappedEventArgs)
InputElement.OnDoubleTapped(TappedEventArgs)
InputElement.OnHolding(HoldingRoutedEventArgs)
InputElement.UpdateIsEffectivelyEnabled()
InputElement.GetIsHoldingEnabled(StyledElement)
InputElement.GetIsHoldWithMouseEnabled(StyledElement)
InputElement.Focusable
InputElement.IsEnabled
InputElement.Cursor
InputElement.IsKeyboardFocusWithin
InputElement.IsFocused
InputElement.IsHitTestVisible
InputElement.IsPointerOver
InputElement.IsTabStop
InputElement.IsEffectivelyEnabled
InputElement.TabIndex
InputElement.KeyBindings
InputElement.IsEnabledCore
InputElement.GestureRecognizers
InputElement.GotFocus
InputElement.GettingFocus
InputElement.LostFocus
InputElement.LosingFocus
InputElement.KeyDown
InputElement.KeyUp
InputElement.TextInput
InputElement.TextInputMethodClientRequested
InputElement.PointerEntered
InputElement.PointerExited
InputElement.PointerMoved
InputElement.PointerPressed
InputElement.PointerReleased
InputElement.PointerCaptureLost
InputElement.PointerWheelChanged
InputElement.ContextRequested
InputElement.ContextCanceled
InputElement.Pinch
InputElement.PinchEnded
InputElement.PullGesture
InputElement.PullGestureEnded
InputElement.ScrollGesture
InputElement.ScrollGestureInertiaStarting
InputElement.ScrollGestureEnded
InputElement.PointerTouchPadGestureMagnify
InputElement.PointerTouchPadGestureRotate
InputElement.SwipeGesture
InputElement.SwipeGestureEnded
InputElement.PointerTouchPadGestureSwipe
InputElement.Tapped
InputElement.RightTapped
InputElement.Holding
InputElement.DoubleTapped
Interactive.RaiseEvent(RoutedEventArgs)
Interactive.BuildEventRoute(RoutedEvent)
Interactive.InteractiveParent
Layoutable.DesiredSizeProperty
Layoutable.WidthProperty
Layoutable.HeightProperty
Layoutable.MinWidthProperty
Layoutable.MaxWidthProperty
Layoutable.MinHeightProperty
Layoutable.MaxHeightProperty
Layoutable.MarginProperty
Layoutable.HorizontalAlignmentProperty
Layoutable.VerticalAlignmentProperty
Layoutable.UseLayoutRoundingProperty
Layoutable.UpdateLayout()
Layoutable.Measure(Size)
Layoutable.Arrange(Rect)
Layoutable.InvalidateMeasure()
Layoutable.InvalidateArrange()
Layoutable.AffectsMeasure<T>(params AvaloniaProperty[])
Layoutable.AffectsArrange<T>(params AvaloniaProperty[])
Layoutable.MeasureCore(Size)
Layoutable.MeasureOverride(Size)
Layoutable.ArrangeCore(Rect)
Layoutable.ArrangeOverride(Size)
Layoutable.OnMeasureInvalidated()
Layoutable.OnVisualParentChanged(Visual, Visual)
Layoutable.OnTemplatedParentControlThemeChanged()
Layoutable.Width
Layoutable.Height
Layoutable.MinWidth
Layoutable.MaxWidth
Layoutable.MinHeight
Layoutable.MaxHeight
Layoutable.Margin
Layoutable.HorizontalAlignment
Layoutable.VerticalAlignment
Layoutable.DesiredSize
Layoutable.IsMeasureValid
Layoutable.IsArrangeValid
Layoutable.UseLayoutRounding
Layoutable.EffectiveViewportChanged
Layoutable.LayoutUpdated
Visual.BoundsProperty
Visual.ClipToBoundsProperty
Visual.ClipProperty
Visual.IsVisibleProperty
Visual.OpacityProperty
Visual.OpacityMaskProperty
Visual.CacheModeProperty
Visual.EffectProperty
Visual.HasMirrorTransformProperty
Visual.RenderTransformProperty
Visual.RenderTransformOriginProperty
Visual.FlowDirectionProperty
Visual.VisualParentProperty
Visual.ZIndexProperty
Visual.CreateCompositionVisual(Compositor)
Visual.DetachFromCompositor()
Visual.SynchronizeCompositionChildVisuals()
Visual.SynchronizeCompositionProperties()
Visual.GetFlowDirection(Visual)
Visual.SetFlowDirection(Visual, FlowDirection)
Visual.InvalidateVisual()
Visual.Render(DrawingContext)
Visual.AffectsRender<T>(params AvaloniaProperty[])
Visual.OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)
Visual.OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
Visual.IAvaloniaListItemValidator<Visual>.Validate(Visual)
Visual.InvalidateMirrorTransform()
Visual.Bounds
Visual.ClipToBounds
Visual.Clip
Visual.IsEffectivelyVisible
Visual.IsVisible
Visual.Opacity
Visual.OpacityMask
Visual.CacheMode
Visual.Effect
Visual.HasMirrorTransform
Visual.RenderTransform
Visual.RenderTransformOrigin
Visual.FlowDirection
Visual.ZIndex
Visual.VisualChildren
Visual.VisualRoot
Visual.BypassFlowDirectionPolicies
Visual.AttachedToVisualTree
Visual.DetachedFromVisualTree
StyledElement.DataContextProperty
StyledElement.NameProperty
StyledElement.ParentProperty
StyledElement.TemplatedParentProperty
StyledElement.ThemeProperty
StyledElement.BeginInit()
StyledElement.EndInit()
StyledElement.ApplyStyling()
StyledElement.InitializeIfNeeded()
StyledElement.ILogical.NotifyAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)
StyledElement.ILogical.NotifyDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)
StyledElement.ILogical.NotifyResourcesChanged(ResourcesChangedEventArgs)
StyledElement.IResourceHost.NotifyHostedResourcesChanged(ResourcesChangedEventArgs)
StyledElement.ISetLogicalParent.SetParent(ILogical)
StyledElement.ISetInheritanceParent.SetParent(AvaloniaObject)
StyledElement.OnDataContextBeginUpdate()
StyledElement.OnDataContextEndUpdate()
StyledElement.OnInitialized()
StyledElement.IAvaloniaListItemValidator<ILogical>.Validate(ILogical)
StyledElement.Name
StyledElement.Classes
StyledElement.DataContext
StyledElement.IsInitialized
StyledElement.Styles
StyledElement.StyleKey
StyledElement.Resources
StyledElement.TemplatedParent
StyledElement.Theme
StyledElement.LogicalChildren
StyledElement.PseudoClasses
StyledElement.StyleKeyOverride
StyledElement.ILogical.IsAttachedToLogicalTree
StyledElement.Parent
StyledElement.ActualThemeVariant
StyledElement.ILogical.LogicalParent
StyledElement.ILogical.LogicalChildren
StyledElement.IResourceNode.HasResources
StyledElement.IStyleHost.IsStylesInitialized
StyledElement.IStyleHost.StylingParent
StyledElement.AttachedToLogicalTree
StyledElement.DetachedFromLogicalTree
StyledElement.DataContextChanged
StyledElement.Initialized
StyledElement.ResourcesChanged
StyledElement.ActualThemeVariantChanged
Animatable.TransitionsProperty
Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)
Animatable.Transitions
AvaloniaObject.CheckAccess()
AvaloniaObject.VerifyAccess()
AvaloniaObject.ClearValue(AvaloniaProperty)
AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)
AvaloniaObject.ClearValue<T>(StyledProperty<T>)
AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)
AvaloniaObject.GetHashCode()
AvaloniaObject.GetValue(AvaloniaProperty)
AvaloniaObject.GetValue<T>(StyledProperty<T>)
AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)
AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)
AvaloniaObject.IsAnimating(AvaloniaProperty)
AvaloniaObject.IsSet(AvaloniaProperty)
AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)
AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)
AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)
AvaloniaObject.Bind(AvaloniaProperty, BindingBase)
AvaloniaObject.CoerceValue(AvaloniaProperty)
AvaloniaObject.IAvaloniaObjectDebug.GetPropertyChangedSubscribers()
AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)
AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)
AvaloniaObject.InheritanceParent
AvaloniaObject.this[AvaloniaProperty]
AvaloniaObject.this[IndexerDescriptor]
AvaloniaObject.Dispatcher
AvaloniaObject.PropertyChanged
Namespace: MOSAIC.Views
Assembly: MOSAIC.dll
Syntax
public class GraphCanvas : UserControl, IAvaloniaObjectDebug, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, INamed, IAvaloniaListItemValidator<ILogical>, IAvaloniaListItemValidator<Visual>, IInputElement, IDataTemplateHost, IVisualBrushInitialize, ISetterValue, IContentControl, IContentPresenterHost

Constructors

GraphCanvas()

Declaration
public GraphCanvas()

Fields

GhostH

Declaration
private const double GhostH = 45
Field Value
Type Description
double

GhostW

Declaration
private const double GhostW = 132
Field Value
Type Description
double

GridPattern

Declaration
internal GridPatternControl GridPattern
Field Value
Type Description
GridPatternControl

GroupBtn

Declaration
internal Button GroupBtn
Field Value
Type Description
Button

GroupToolbar

Declaration
internal Border GroupToolbar
Field Value
Type Description
Border

PanHost

Declaration
internal Canvas PanHost
Field Value
Type Description
Canvas

PortHitRadius

Declaration
private const double PortHitRadius = 14
Field Value
Type Description
double

PortSnapRadius

Declaration
private const double PortSnapRadius = 26
Field Value
Type Description
double

Root

Declaration
internal Border Root
Field Value
Type Description
Border

RootCanvas

Declaration
internal Canvas RootCanvas
Field Value
Type Description
Canvas

ScaleFactor

Declaration
private const double ScaleFactor = 1.1
Field Value
Type Description
double

ScaleMax

Declaration
private const double ScaleMax = 3
Field Value
Type Description
double

ScaleMin

Declaration
private const double ScaleMin = 0.05
Field Value
Type Description
double

SelectionRect

Declaration
internal Border SelectionRect
Field Value
Type Description
Border

SnapGrid

Declaration
private const double SnapGrid = 20
Field Value
Type Description
double

UngroupBtn

Declaration
internal Button UngroupBtn
Field Value
Type Description
Button

VerticesProperty

Declaration
public static readonly StyledProperty<ObservableCollection<VertexViewModel>?> VerticesProperty
Field Value
Type Description
StyledProperty<ObservableCollection<VertexViewModel>>

_connectSource

Declaration
private VertexViewModel? _connectSource
Field Value
Type Description
VertexViewModel

_connectTarget

Declaration
private VertexViewModel? _connectTarget
Field Value
Type Description
VertexViewModel

_connectTargetValid

Declaration
private bool _connectTargetValid
Field Value
Type Description
bool

_connecting

Declaration
private bool _connecting
Field Value
Type Description
bool

_edges

Declaration
private EdgeDrawableControl? _edges
Field Value
Type Description
EdgeDrawableControl

_ghost

Declaration
private Border? _ghost
Field Value
Type Description
Border

_groupBtn

Declaration
private Button? _groupBtn
Field Value
Type Description
Button

_groupControls

Declaration
private readonly Dictionary<VertexGroupViewModel, Control> _groupControls
Field Value
Type Description
Dictionary<VertexGroupViewModel, Control>

_groupDragAnchor

Declaration
private Point _groupDragAnchor
Field Value
Type Description
Point

_groupDragOrigins

Declaration
private Dictionary<VertexViewModel, Point>? _groupDragOrigins
Field Value
Type Description
Dictionary<VertexViewModel, Point>

_groupDragging

Declaration
private bool _groupDragging
Field Value
Type Description
bool

_groupNodeDragOrigins

Declaration
private Dictionary<VertexGroupViewModel, Point>? _groupNodeDragOrigins
Field Value
Type Description
Dictionary<VertexGroupViewModel, Point>

_groupToolbar

Declaration
private Border? _groupToolbar
Field Value
Type Description
Border

_groups

Declaration
private readonly List<VertexGroupViewModel> _groups
Field Value
Type Description
List<VertexGroupViewModel>

_lastLayoutSize

Declaration
private Size _lastLayoutSize
Field Value
Type Description
Size

_memberRedirects

Tracks original member references temporarily removed from external vertex Neighbors lists so we can restore them on cleanup.

Declaration
private readonly List<(VertexViewModel Vertex, VertexViewModel Member)> _memberRedirects
Field Value
Type Description
List<(VertexViewModel Vertex, VertexViewModel Proxy)>

_neighborRedirects

Tracks proxy vertices temporarily added to external vertex Neighbors lists so we can clean them up before each rebuild.

Declaration
private readonly List<(VertexViewModel Vertex, VertexViewModel Proxy)> _neighborRedirects
Field Value
Type Description
List<(VertexViewModel Vertex, VertexViewModel Proxy)>

_nodeInteracting

Set by node/group press handlers so the canvas-level handler knows NOT to start rubber-banding.

Declaration
private bool _nodeInteracting
Field Value
Type Description
bool

_ox

Declaration
private double _ox
Field Value
Type Description
double

_oy

Declaration
private double _oy
Field Value
Type Description
double

_panHost

Declaration
private Canvas? _panHost
Field Value
Type Description
Canvas

_panStart

Declaration
private Point _panStart
Field Value
Type Description
Point

_panning

Declaration
private bool _panning
Field Value
Type Description
bool

_root

Declaration
private Canvas? _root
Field Value
Type Description
Canvas

_rubberBanding

Declaration
private bool _rubberBanding
Field Value
Type Description
bool

_rubberStart

Declaration
private Point _rubberStart
Field Value
Type Description
Point

_scale

Declaration
private double _scale
Field Value
Type Description
double

_selectedGroups

Declaration
private readonly HashSet<VertexGroupViewModel> _selectedGroups
Field Value
Type Description
HashSet<VertexGroupViewModel>

_selectedVertices

Declaration
private readonly HashSet<VertexViewModel> _selectedVertices
Field Value
Type Description
HashSet<VertexViewModel>

_selectionRect

Declaration
private Border? _selectionRect
Field Value
Type Description
Border

_ungroupBtn

Declaration
private Button? _ungroupBtn
Field Value
Type Description
Button

_vm

Declaration
private readonly Dictionary<VertexViewModel, PropertyChangedEventHandler> _vm
Field Value
Type Description
Dictionary<VertexViewModel, PropertyChangedEventHandler>

Properties

Vertices

Declaration
public ObservableCollection<VertexViewModel>? Vertices { get; set; }
Property Value
Type Description
ObservableCollection<VertexViewModel>

Methods

AddGroupNode(VertexGroupViewModel)

Declaration
private void AddGroupNode(VertexGroupViewModel gvm)
Parameters
Type Name Description
VertexGroupViewModel gvm

AddNode(VertexViewModel)

Declaration
private void AddNode(VertexViewModel vm)
Parameters
Type Name Description
VertexViewModel vm

ApplyTransform()

Declaration
private void ApplyTransform()

BeginConnection(VertexViewModel)

Declaration
private void BeginConnection(VertexViewModel source)
Parameters
Type Name Description
VertexViewModel source

CanConnect(VertexViewModel, VertexViewModel)

Whether a wire source→target is allowed (capacity, whitelist, no duplicate, no cycle).

Declaration
private static bool CanConnect(VertexViewModel src, VertexViewModel tgt)
Parameters
Type Name Description
VertexViewModel src
VertexViewModel tgt
Returns
Type Description
bool

CleanUpProxyRedirects()

Declaration
private void CleanUpProxyRedirects()

ClearGroups()

Releases group subscriptions and references when the pipeline is replaced.

Declaration
public void ClearGroups()

ClearPalettePreview()

Declaration
private void ClearPalettePreview()

ClearSelection()

Declaration
private void ClearSelection()

CreatesCycle(VertexViewModel, VertexViewModel)

Adding src as tgt's input loops iff tgt already feeds src (tgt in src's upstream closure).

Declaration
private static bool CreatesCycle(VertexViewModel src, VertexViewModel tgt)
Parameters
Type Name Description
VertexViewModel src
VertexViewModel tgt
Returns
Type Description
bool

DeselectGroup(VertexGroupViewModel)

Declaration
private void DeselectGroup(VertexGroupViewModel gvm)
Parameters
Type Name Description
VertexGroupViewModel gvm

DeselectVertex(VertexViewModel)

Declaration
private void DeselectVertex(VertexViewModel vm)
Parameters
Type Name Description
VertexViewModel vm

Dist(Point, Point)

Declaration
private static double Dist(Point a, Point b)
Parameters
Type Name Description
Point a
Point b
Returns
Type Description
double

EndConnectionDrag(bool)

Declaration
private void EndConnectionDrag(bool commit)
Parameters
Type Name Description
bool commit

FindInputTarget(VertexViewModel, Point)

Nearest input port within snap range, plus whether wiring source→it is allowed.

Declaration
private (VertexViewModel?, bool) FindInputTarget(VertexViewModel src, Point graphPt)
Parameters
Type Name Description
VertexViewModel src
Point graphPt
Returns
Type Description
(VertexViewModel, bool)

FitToView()

Frames the entire graph — every visible node and group node — inside the viewport using the pan/zoom transform, so the whole block diagram stays on screen. Called on (re)build and on every resize; manual zoom/pan overrides it until the next fit. Large/complex graphs scale down to fit; small graphs are shown at up to natural size (never blown up absurdly).

Declaration
public void FitToView()

GetVisibleVertices()

Returns vertices that are NOT inside any collapsed group.

Declaration
private List<VertexViewModel> GetVisibleVertices()
Returns
Type Description
List<VertexViewModel>

GroupSelectedVertices()

Declaration
private void GroupSelectedVertices()

Init()

Declaration
private void Init()

InitializeComponent(bool)

Wires up the controls and optionally loads XAML markup and attaches dev tools (if Avalonia.Diagnostics package is referenced).

Declaration
[ExcludeFromCodeCoverage]
public void InitializeComponent(bool loadXaml = true)
Parameters
Type Name Description
bool loadXaml

Should the XAML be loaded into the component.

IsOnOutputPort(VertexViewModel, Point)

True when graphPt (graph space) is on the block's output port.

Declaration
private bool IsOnOutputPort(VertexViewModel vm, Point graphPt)
Parameters
Type Name Description
VertexViewModel vm
Point graphPt
Returns
Type Description
bool

IsPaletteCompatible(BlockDescriptor, VertexViewModel)

Whether the dragged palette type d could connect with existing block e in either direction (feed it, or be fed by it), honouring type and capacity.

Declaration
private static bool IsPaletteCompatible(BlockDescriptor d, VertexViewModel e)
Parameters
Type Name Description
BlockDescriptor d
VertexViewModel e
Returns
Type Description
bool

MoveGroupNode(VertexGroupViewModel, float, float)

Declaration
private void MoveGroupNode(VertexGroupViewModel gvm, float nx, float ny)
Parameters
Type Name Description
VertexGroupViewModel gvm
float nx
float ny

NearestInputAnchor(VertexViewModel, Point)

Declaration
private static Point NearestInputAnchor(VertexViewModel v, Point graphPt)
Parameters
Type Name Description
VertexViewModel v
Point graphPt
Returns
Type Description
Point

OnGroupClicked(object?, RoutedEventArgs)

Declaration
private void OnGroupClicked(object? sender, RoutedEventArgs e)
Parameters
Type Name Description
object sender
RoutedEventArgs e

OnMove(object?, PointerEventArgs)

Declaration
private void OnMove(object? s, PointerEventArgs e)
Parameters
Type Name Description
object s
PointerEventArgs e

OnPaletteDragLeave(object?, DragEventArgs)

Declaration
private void OnPaletteDragLeave(object? sender, DragEventArgs e)
Parameters
Type Name Description
object sender
DragEventArgs e

OnPaletteDragOver(object?, DragEventArgs)

Declaration
private void OnPaletteDragOver(object? sender, DragEventArgs e)
Parameters
Type Name Description
object sender
DragEventArgs e

OnPaletteDrop(object?, DragEventArgs)

Declaration
private void OnPaletteDrop(object? sender, DragEventArgs e)
Parameters
Type Name Description
object sender
DragEventArgs e

OnPress(object?, PointerPressedEventArgs)

Declaration
private void OnPress(object? s, PointerPressedEventArgs e)
Parameters
Type Name Description
object s
PointerPressedEventArgs e

OnRelease(object?, PointerReleasedEventArgs)

Declaration
private void OnRelease(object? s, PointerReleasedEventArgs e)
Parameters
Type Name Description
object s
PointerReleasedEventArgs e

OnSizeChanged(object?, SizeChangedEventArgs)

Declaration
private void OnSizeChanged(object? sender, SizeChangedEventArgs e)
Parameters
Type Name Description
object sender
SizeChangedEventArgs e

OnUngroupClicked(object?, RoutedEventArgs)

Declaration
private void OnUngroupClicked(object? sender, RoutedEventArgs e)
Parameters
Type Name Description
object sender
RoutedEventArgs e

OnVerts(object?, NotifyCollectionChangedEventArgs)

Declaration
private void OnVerts(object? s, NotifyCollectionChangedEventArgs e)
Parameters
Type Name Description
object s
NotifyCollectionChangedEventArgs e

OnWheel(object?, PointerWheelEventArgs)

Declaration
private void OnWheel(object? s, PointerWheelEventArgs e)
Parameters
Type Name Description
object s
PointerWheelEventArgs e

OverlapsExisting(Rect)

Declaration
private bool OverlapsExisting(Rect r)
Parameters
Type Name Description
Rect r
Returns
Type Description
bool

Rebuild()

Declaration
private void Rebuild()

RemoveGroupControl(VertexGroupViewModel)

Declaration
private void RemoveGroupControl(VertexGroupViewModel gvm)
Parameters
Type Name Description
VertexGroupViewModel gvm

RemoveNode(VertexViewModel)

Declaration
private void RemoveNode(VertexViewModel vm)
Parameters
Type Name Description
VertexViewModel vm

ResolveDropPosition(Point)

Snaps the drop point (centred on the cursor) to the grid, then nudges downward off any existing node so a fresh block never lands on top of another.

Declaration
private Point ResolveDropPosition(Point cursorGraph)
Parameters
Type Name Description
Point cursorGraph
Returns
Type Description
Point

SelectGroup(VertexGroupViewModel)

Declaration
private void SelectGroup(VertexGroupViewModel gvm)
Parameters
Type Name Description
VertexGroupViewModel gvm

SelectVertex(VertexViewModel)

Declaration
private void SelectVertex(VertexViewModel vm)
Parameters
Type Name Description
VertexViewModel vm

SelectVerticesInRect(Rect)

Declaration
private void SelectVerticesInRect(Rect rect)
Parameters
Type Name Description
Rect rect

ShowGhost(BlockDescriptor, Point)

Declaration
private void ShowGhost(BlockDescriptor d, Point pos)
Parameters
Type Name Description
BlockDescriptor d
Point pos

SizeEdges()

Declaration
private void SizeEdges()

Snap(double)

Declaration
private static double Snap(double v)
Parameters
Type Name Description
double v
Returns
Type Description
double

ToggleGroup(VertexGroupViewModel)

Declaration
private void ToggleGroup(VertexGroupViewModel gvm)
Parameters
Type Name Description
VertexGroupViewModel gvm

ToggleVertex(VertexViewModel)

Declaration
private void ToggleVertex(VertexViewModel vm)
Parameters
Type Name Description
VertexViewModel vm

UngroupBlocks(ISet<BaseBlock>)

Restores affected member cards before their blocks are deleted.

Declaration
public void UngroupBlocks(ISet<BaseBlock> blocks)
Parameters
Type Name Description
ISet<BaseBlock> blocks

UngroupSelectedGroup()

Declaration
private void UngroupSelectedGroup()

UpdateConnectionDrag(Point)

Recompute the target/validity and update the rubber-band wire for the current cursor.

Declaration
private void UpdateConnectionDrag(Point graphPt)
Parameters
Type Name Description
Point graphPt

UpdateDropHighlights(BlockDescriptor)

Declaration
private void UpdateDropHighlights(BlockDescriptor d)
Parameters
Type Name Description
BlockDescriptor d

UpdateToolbar()

Declaration
private void UpdateToolbar()

WireGroupProxies(List<VertexViewModel>, List<VertexGroupViewModel>)

For each visible group, creates/updates a proxy VertexViewModel and wires external edges so EdgeDrawableControl draws arrows to/from the group node.

Declaration
private void WireGroupProxies(List<VertexViewModel> visibleVertices, List<VertexGroupViewModel> visibleGroups)
Parameters
Type Name Description
List<VertexViewModel> visibleVertices
List<VertexGroupViewModel> visibleGroups

Events

BlockDescriptorDropped

Fired when a block is dropped from the palette, with the canvas-space drop point.

Declaration
public event EventHandler<(BlockDescriptor Descriptor, Point CanvasPosition)>? BlockDescriptorDropped
Event Type
Type Description
EventHandler<(BlockDescriptor Descriptor, Point CanvasPosition)>

ConnectionCreated

Fired when the user completes a valid wire from a source block's output to a target block's input.

Declaration
public event EventHandler<(VertexViewModel Source, VertexViewModel Target)>? ConnectionCreated
Event Type
Type Description
EventHandler<(VertexViewModel Source, VertexViewModel Target)>

GroupCreated

Fired when blocks are grouped. Contains the new group.

Declaration
public event EventHandler<VertexGroupViewModel>? GroupCreated
Event Type
Type Description
EventHandler<VertexGroupViewModel>

GroupRemoved

Fired when a group is dissolved. Contains the removed group.

Declaration
public event EventHandler<VertexGroupViewModel>? GroupRemoved
Event Type
Type Description
EventHandler<VertexGroupViewModel>

NodeClicked

Declaration
public event EventHandler<VertexViewModel>? NodeClicked
Event Type
Type Description
EventHandler<VertexViewModel>

Implements

Avalonia.Diagnostics.IAvaloniaObjectDebug
INotifyPropertyChanged
Avalonia.IDataContextProvider
Avalonia.LogicalTree.ILogical
Avalonia.Styling.IThemeVariantHost
Avalonia.Controls.IResourceHost
Avalonia.Controls.IResourceNode
Avalonia.Styling.IStyleHost
Avalonia.Controls.ISetLogicalParent
Avalonia.Controls.ISetInheritanceParent
ISupportInitialize
Avalonia.INamed
Avalonia.Collections.IAvaloniaListItemValidator<T>
Avalonia.Collections.IAvaloniaListItemValidator<T>
Avalonia.Input.IInputElement
Avalonia.Controls.Templates.IDataTemplateHost
Avalonia.Rendering.IVisualBrushInitialize
Avalonia.Styling.ISetterValue
Avalonia.Controls.IContentControl
Avalonia.Controls.Presenters.IContentPresenterHost

Search documentation

Start typing to search the documentation.