IVisual Interface

Summary

Represents control that has a visual on-screen representation.
Namespace
Avalonia.VisualTree
Implementing Types
graph BT Type["IVisual"] class Type type-node Implementing0["IMenuItem"]-.->Type click Implementing0 "/api/Avalonia.Controls/IMenuItem" Implementing1["IVirtualizingPanel"]-.->Type click Implementing1 "/api/Avalonia.Controls/IVirtualizingPanel" Implementing2["ReactiveWindow<TViewModel>"]-.->Type click Implementing2 "/api/Avalonia.ReactiveUI/ReactiveWindow_1" Implementing3["TreeView"]-.->Type click Implementing3 "/api/Avalonia.Controls/TreeView" Implementing4["Thumb"]-.->Type click Implementing4 "/api/Avalonia.Controls.Primitives/Thumb" Implementing5["Separator"]-.->Type click Implementing5 "/api/Avalonia.Controls/Separator" Implementing6["ComboBox"]-.->Type click Implementing6 "/api/Avalonia.Controls/ComboBox" Implementing7["IRenderRoot"]-.->Type click Implementing7 "/api/Avalonia.Rendering/IRenderRoot" Implementing8["UserControl"]-.->Type click Implementing8 "/api/Avalonia.Controls/UserControl" Implementing9["Decorator"]-.->Type click Implementing9 "/api/Avalonia.Controls/Decorator" Implementing10["Slider"]-.->Type click Implementing10 "/api/Avalonia.Controls/Slider" Implementing11["ContextMenu"]-.->Type click Implementing11 "/api/Avalonia.Controls/ContextMenu" Implementing12["Ellipse"]-.->Type click Implementing12 "/api/Avalonia.Controls.Shapes/Ellipse" Implementing13["OverlayLayer"]-.->Type click Implementing13 "/api/Avalonia.Controls.Primitives/OverlayLayer" Implementing14["RadioButton"]-.->Type click Implementing14 "/api/Avalonia.Controls/RadioButton" Implementing15["Control"]-.->Type click Implementing15 "/api/Avalonia.Controls/Control" Implementing16["ListBox"]-.->Type click Implementing16 "/api/Avalonia.Controls/ListBox" Implementing17["SelectingItemsControl"]-.->Type click Implementing17 "/api/Avalonia.Controls.Primitives/SelectingItemsControl" Implementing18["AdornerLayer"]-.->Type click Implementing18 "/api/Avalonia.Controls.Primitives/AdornerLayer" Implementing19["PopupRoot"]-.->Type click Implementing19 "/api/Avalonia.Controls.Primitives/PopupRoot" Implementing20["Layoutable"]-.->Type click Implementing20 "/api/Avalonia.Layout/Layoutable" Implementing21["ViewModelViewHost"]-.->Type click Implementing21 "/api/Avalonia.ReactiveUI/ViewModelViewHost" Implementing22["IMenuElement"]-.->Type click Implementing22 "/api/Avalonia.Controls/IMenuElement" Implementing23["IInputRoot"]-.->Type click Implementing23 "/api/Avalonia.Input/IInputRoot" Implementing24["HeaderedItemsControl"]-.->Type click Implementing24 "/api/Avalonia.Controls.Primitives/HeaderedItemsControl" Implementing25["MenuItem"]-.->Type click Implementing25 "/api/Avalonia.Controls/MenuItem" Implementing26["InputElement"]-.->Type click Implementing26 "/api/Avalonia.Input/InputElement" Implementing27["ItemsRepeater"]-.->Type click Implementing27 "/api/Avalonia.Controls/ItemsRepeater" Implementing28["ComboBoxItem"]-.->Type click Implementing28 "/api/Avalonia.Controls/ComboBoxItem" Implementing29["ILayoutRoot"]-.->Type click Implementing29 "/api/Avalonia.Layout/ILayoutRoot" Implementing30["WrapPanel"]-.->Type click Implementing30 "/api/Avalonia.Controls/WrapPanel" Implementing31["Viewbox"]-.->Type click Implementing31 "/api/Avalonia.Controls/Viewbox" Implementing32["AutoCompleteBox"]-.->Type click Implementing32 "/api/Avalonia.Controls/AutoCompleteBox" Implementing33["TabControl"]-.->Type click Implementing33 "/api/Avalonia.Controls/TabControl" Implementing34["Menu"]-.->Type click Implementing34 "/api/Avalonia.Controls/Menu" Implementing35["DataGridRowGroupHeader"]-.->Type click Implementing35 "/api/Avalonia.Controls/DataGridRowGroupHeader" Implementing36["StackPanel"]-.->Type click Implementing36 "/api/Avalonia.Controls/StackPanel" Implementing37["TabItem"]-.->Type click Implementing37 "/api/Avalonia.Controls/TabItem" Implementing38["Interactive"]-.->Type click Implementing38 "/api/Avalonia.Interactivity/Interactive" Implementing39["ItemsPresenterBase"]-.->Type click Implementing39 "/api/Avalonia.Controls.Presenters/ItemsPresenterBase" Implementing40["ListBoxItem"]-.->Type click Implementing40 "/api/Avalonia.Controls/ListBoxItem" Implementing41["ScrollViewer"]-.->Type click Implementing41 "/api/Avalonia.Controls/ScrollViewer" Implementing42["CalendarItem"]-.->Type click Implementing42 "/api/Avalonia.Controls.Primitives/CalendarItem" Implementing43["ILayoutable"]-.->Type click Implementing43 "/api/Avalonia.Layout/ILayoutable" Implementing44["Popup"]-.->Type click Implementing44 "/api/Avalonia.Controls.Primitives/Popup" Implementing45["DevTools"]-.->Type click Implementing45 "/api/Avalonia.Diagnostics/DevTools" Implementing46["DataGridDetailsPresenter"]-.->Type click Implementing46 "/api/Avalonia.Controls.Primitives/DataGridDetailsPresenter" Implementing47["TreeViewItem"]-.->Type click Implementing47 "/api/Avalonia.Controls/TreeViewItem" Implementing48["Shape"]-.->Type click Implementing48 "/api/Avalonia.Controls.Shapes/Shape" Implementing49["DataGridCell"]-.->Type click Implementing49 "/api/Avalonia.Controls/DataGridCell" Implementing50["VisualLayerManager"]-.->Type click Implementing50 "/api/Avalonia.Controls.Primitives/VisualLayerManager" Implementing51["ButtonSpinner"]-.->Type click Implementing51 "/api/Avalonia.Controls/ButtonSpinner" Implementing52["ProgressBar"]-.->Type click Implementing52 "/api/Avalonia.Controls/ProgressBar" Implementing53["RepeatButton"]-.->Type click Implementing53 "/api/Avalonia.Controls/RepeatButton" Implementing54["TransitioningContentControl"]-.->Type click Implementing54 "/api/Avalonia.ReactiveUI/TransitioningContentControl" Implementing55["HeaderedSelectingItemsControl"]-.->Type click Implementing55 "/api/Avalonia.Controls.Primitives/HeaderedSelectingItemsControl" Implementing56["Path"]-.->Type click Implementing56 "/api/Avalonia.Controls.Shapes/Path" Implementing57["IMenu"]-.->Type click Implementing57 "/api/Avalonia.Controls/IMenu" Implementing58["Panel"]-.->Type click Implementing58 "/api/Avalonia.Controls/Panel" Implementing59["AccessText"]-.->Type click Implementing59 "/api/Avalonia.Controls.Primitives/AccessText" Implementing60["ItemsPresenter"]-.->Type click Implementing60 "/api/Avalonia.Controls.Presenters/ItemsPresenter" Implementing61["TabStrip"]-.->Type click Implementing61 "/api/Avalonia.Controls.Primitives/TabStrip" Implementing62["DataGridRow"]-.->Type click Implementing62 "/api/Avalonia.Controls/DataGridRow" Implementing63["UniformGrid"]-.->Type click Implementing63 "/api/Avalonia.Controls.Primitives/UniformGrid" Implementing64["Spinner"]-.->Type click Implementing64 "/api/Avalonia.Controls/Spinner" Implementing65["ReversibleStackPanel"]-.->Type click Implementing65 "/api/Avalonia.Controls/ReversibleStackPanel" Implementing66["DropDown"]-.->Type click Implementing66 "/api/Avalonia.Controls/DropDown" Implementing67["ItemsControl"]-.->Type click Implementing67 "/api/Avalonia.Controls/ItemsControl" Implementing68["Calendar"]-.->Type click Implementing68 "/api/Avalonia.Controls/Calendar" Implementing69["RangeBase"]-.->Type click Implementing69 "/api/Avalonia.Controls.Primitives/RangeBase" Implementing70["DataGridRowsPresenter"]-.->Type click Implementing70 "/api/Avalonia.Controls.Primitives/DataGridRowsPresenter" Implementing71["AutoCompleteBox.BindingEvaluator<T>"]-.->Type click Implementing71 "/api/Avalonia.Controls/BindingEvaluator_1" Implementing72["TabStripItem"]-.->Type click Implementing72 "/api/Avalonia.Controls.Primitives/TabStripItem" Implementing73["GridSplitter"]-.->Type click Implementing73 "/api/Avalonia.Controls/GridSplitter" Implementing74["Polyline"]-.->Type click Implementing74 "/api/Avalonia.Controls.Shapes/Polyline" Implementing75["DataGridFrozenGrid"]-.->Type click Implementing75 "/api/Avalonia.Controls.Primitives/DataGridFrozenGrid" Implementing76["ToolTip"]-.->Type click Implementing76 "/api/Avalonia.Controls/ToolTip" Implementing77["CalendarButton"]-.->Type click Implementing77 "/api/Avalonia.Controls.Primitives/CalendarButton" Implementing78["IContentControl"]-.->Type click Implementing78 "/api/Avalonia.Controls/IContentControl" Implementing79["Rectangle"]-.->Type click Implementing79 "/api/Avalonia.Controls.Shapes/Rectangle" Implementing80["Border"]-.->Type click Implementing80 "/api/Avalonia.Controls/Border" Implementing81["DataGridRowHeader"]-.->Type click Implementing81 "/api/Avalonia.Controls.Primitives/DataGridRowHeader" Implementing82["HeaderedContentControl"]-.->Type click Implementing82 "/api/Avalonia.Controls.Primitives/HeaderedContentControl" Implementing83["NumericUpDown"]-.->Type click Implementing83 "/api/Avalonia.Controls/NumericUpDown" Implementing84["IContentPresenter"]-.->Type click Implementing84 "/api/Avalonia.Controls.Presenters/IContentPresenter" Implementing85["EmbeddableControlRoot"]-.->Type click Implementing85 "/api/Avalonia.Controls.Embedding/EmbeddableControlRoot" Implementing86["IEmbeddedLayoutRoot"]-.->Type click Implementing86 "/api/Avalonia.Layout/IEmbeddedLayoutRoot" Implementing87["Canvas"]-.->Type click Implementing87 "/api/Avalonia.Controls/Canvas" Implementing88["RemoteWidget"]-.->Type click Implementing88 "/api/Avalonia.Controls.Remote/RemoteWidget" Implementing89["Line"]-.->Type click Implementing89 "/api/Avalonia.Controls.Shapes/Line" Implementing90["ContentPresenter"]-.->Type click Implementing90 "/api/Avalonia.Controls.Presenters/ContentPresenter" Implementing91["ScrollContentPresenter"]-.->Type click Implementing91 "/api/Avalonia.Controls.Presenters/ScrollContentPresenter" Implementing92["NativeMenuBar"]-.->Type click Implementing92 "/api/Avalonia.Controls/NativeMenuBar" Implementing93["ReactiveUserControl<TViewModel>"]-.->Type click Implementing93 "/api/Avalonia.ReactiveUI/ReactiveUserControl_1" Implementing94["CheckBox"]-.->Type click Implementing94 "/api/Avalonia.Controls/CheckBox" Implementing95["CalendarDayButton"]-.->Type click Implementing95 "/api/Avalonia.Controls.Primitives/CalendarDayButton" Implementing96["ToggleButton"]-.->Type click Implementing96 "/api/Avalonia.Controls.Primitives/ToggleButton" Implementing97["DockPanel"]-.->Type click Implementing97 "/api/Avalonia.Controls/DockPanel" Implementing98["DataGridColumnHeader"]-.->Type click Implementing98 "/api/Avalonia.Controls/DataGridColumnHeader" Implementing99["Expander"]-.->Type click Implementing99 "/api/Avalonia.Controls/Expander" Implementing100["DatePicker"]-.->Type click Implementing100 "/api/Avalonia.Controls/DatePicker" Implementing101["Track"]-.->Type click Implementing101 "/api/Avalonia.Controls.Primitives/Track" Implementing102["TextBox"]-.->Type click Implementing102 "/api/Avalonia.Controls/TextBox" Implementing103["RoutedViewHost"]-.->Type click Implementing103 "/api/Avalonia.ReactiveUI/RoutedViewHost" Implementing104["Visual"]-.->Type click Implementing104 "/api/Avalonia/Visual" Implementing105["Image"]-.->Type click Implementing105 "/api/Avalonia.Controls/Image" Implementing106["VirtualizingStackPanel"]-.->Type click Implementing106 "/api/Avalonia.Controls/VirtualizingStackPanel" Implementing107["IInputElement"]-.->Type click Implementing107 "/api/Avalonia.Input/IInputElement" Implementing108["IControl"]-.->Type click Implementing108 "/api/Avalonia.Controls/IControl" Implementing109["DrawingPresenter"]-.->Type click Implementing109 "/api/Avalonia.Controls/DrawingPresenter" Implementing110["ContentControl"]-.->Type click Implementing110 "/api/Avalonia.Controls/ContentControl" Implementing111["CarouselPresenter"]-.->Type click Implementing111 "/api/Avalonia.Controls.Presenters/CarouselPresenter" Implementing112["Button"]-.->Type click Implementing112 "/api/Avalonia.Controls/Button" Implementing113["Polygon"]-.->Type click Implementing113 "/api/Avalonia.Controls.Shapes/Polygon" Implementing114["DataGrid"]-.->Type click Implementing114 "/api/Avalonia.Controls/DataGrid" Implementing115["TemplatedControl"]-.->Type click Implementing115 "/api/Avalonia.Controls.Primitives/TemplatedControl" Implementing116["LayoutTransformControl"]-.->Type click Implementing116 "/api/Avalonia.Controls/LayoutTransformControl" Implementing117["DataGridColumnHeadersPresenter"]-.->Type click Implementing117 "/api/Avalonia.Controls.Primitives/DataGridColumnHeadersPresenter" Implementing118["DropDownItem"]-.->Type click Implementing118 "/api/Avalonia.Controls/DropDownItem" Implementing119["WindowNotificationManager"]-.->Type click Implementing119 "/api/Avalonia.Controls.Notifications/WindowNotificationManager" Implementing120["IPanel"]-.->Type click Implementing120 "/api/Avalonia.Controls/IPanel" Implementing121["TextPresenter"]-.->Type click Implementing121 "/api/Avalonia.Controls.Presenters/TextPresenter" Implementing122["ScrollBar"]-.->Type click Implementing122 "/api/Avalonia.Controls.Primitives/ScrollBar" Implementing123["IPresenter"]-.->Type click Implementing123 "/api/Avalonia.Controls.Presenters/IPresenter" Implementing124["DataGridCellsPresenter"]-.->Type click Implementing124 "/api/Avalonia.Controls.Primitives/DataGridCellsPresenter" Implementing125["NotificationCard"]-.->Type click Implementing125 "/api/Avalonia.Controls.Notifications/NotificationCard" Implementing126["Grid"]-.->Type click Implementing126 "/api/Avalonia.Controls/Grid" Implementing127["TextBlock"]-.->Type click Implementing127 "/api/Avalonia.Controls/TextBlock" Implementing128["DataValidationErrors"]-.->Type click Implementing128 "/api/Avalonia.Controls/DataValidationErrors" Implementing129["Window"]-.->Type click Implementing129 "/api/Avalonia.Controls/Window" Implementing130["IItemsPresenter"]-.->Type click Implementing130 "/api/Avalonia.Controls.Presenters/IItemsPresenter" Implementing131["Carousel"]-.->Type click Implementing131 "/api/Avalonia.Controls/Carousel" Implementing132["WindowBase"]-.->Type click Implementing132 "/api/Avalonia.Controls/WindowBase" Implementing133["AboutAvaloniaDialog"]-.->Type click Implementing133 "/api/Avalonia.Dialogs/AboutAvaloniaDialog" Implementing134["OverlayPopupHost"]-.->Type click Implementing134 "/api/Avalonia.Controls.Primitives/OverlayPopupHost" Implementing135["MenuBase"]-.->Type click Implementing135 "/api/Avalonia.Controls/MenuBase" Implementing136["TopLevel"]-.->Type click Implementing136 "/api/Avalonia.Controls/TopLevel" Implementing137["IMainMenu"]-.->Type click Implementing137 "/api/Avalonia.Input/IMainMenu"

Syntax

public interface IVisual

Remarks

The IVisual interface defines the interface required for a renderer to render a control. You should not usually need to reference this interface unless you are writing a renderer; instead use the extension methods defined in VisualExtensions to traverse the visual tree. This interface is implemented by Visual. It should not be necessary to implement it anywhere else.

Events

Name Type Summary
AttachedToVisualTree EventHandler<VisualTreeAttachmentEventArgs>
Raised when the control is attached to a rooted visual tree.
DetachedFromVisualTree EventHandler<VisualTreeAttachmentEventArgs>
Raised when the control is detached from a rooted visual tree.

Properties

Name Value Summary
Bounds Rect
Gets the bounds of the control relative to its parent.
Clip Geometry
Gets or sets the geometry clip for this visual.
ClipToBounds bool
Gets a value indicating whether the control should be clipped to its bounds.
IsAttachedToVisualTree bool
Gets a value indicating whether this control is attached to a visual root.
IsEffectivelyVisible bool
Gets a value indicating whether this control and all its parents are visible.
IsVisible bool
Gets or sets a value indicating whether this control is visible.
Opacity double
Gets or sets the opacity of the control.
OpacityMask IBrush
Gets or sets the opacity mask for the control.
RenderTransform Transform
Gets or sets the render transform of the control.
RenderTransformOrigin RelativePoint
Gets or sets the render transform origin of the control.
TransformedBounds TransformedBounds?
Gets the bounds of the control relative to the window, accounting for rendering transforms.
VisualChildren IAvaloniaReadOnlyList<IVisual>
Gets the control's child visuals.
VisualParent IVisual
Gets the control's parent visual.
VisualRoot IRenderRoot
Gets the root of the visual tree, if the control is attached to a visual tree.
ZIndex int
Gets or sets the Z index of the node.

Methods

Name Value Summary
InvalidateVisual() void
Invalidates the visual and queues a repaint.
Render(DrawingContext) void
Renders the control to a DrawingContext.

Extension Methods

Name Value Summary
CalculateDistanceFromAncestor(IVisual) int
Calculates the distance from a visual's IRenderRoot.
FindCommonVisualAncestor(IVisual) IVisual
Tries to get the first common ancestor of two visuals.
GetSelfAndVisualAncestors() IEnumerable<IVisual>
Enumerates an IVisual and its ancestors in the visual tree.
GetSelfAndVisualDescendants() IEnumerable<IVisual>
Enumerates an IVisual and its descendants in the visual tree.
GetVisualAncestors() IEnumerable<IVisual>
Enumerates the ancestors of an IVisual in the visual tree.
GetVisualAt(Point) IVisual
Gets the first visual in the visual tree whose bounds contain a point.
GetVisualChildren() IEnumerable<IVisual>
Enumerates the children of an IVisual in the visual tree.
GetVisualDescendants() IEnumerable<IVisual>
Enumerates the descendants of an IVisual in the visual tree.
GetVisualParent() IVisual
Gets the visual parent of an IVisual.
GetVisualParent<T>() T
Gets the visual parent of an IVisual.
GetVisualRoot() IRenderRoot
Gets the root visual for an IVisual.
GetVisualsAt(Point) IEnumerable<IVisual>
Enumerates the visible visuals in the visual tree whose bounds contain a point.
GetVisualsAt(Point, Func<IVisual, bool>) IEnumerable<IVisual>
Enumerates the visuals in the visual tree whose bounds contain a point.
HitTestCustom(Point) bool
IsVisualAncestorOf(IVisual) bool
Tests whether an IVisual is an ancestor of another visual.
PointToClient(PixelPoint) Point
Converts a point from screen to client coordinates.
PointToScreen(Point) PixelPoint
Converts a point from client to screen coordinates.
TransformToVisual(IVisual) Matrix?
Returns a transform that transforms the visual's coordinates into the coordinates of the specified to.
TranslatePoint(Point, IVisual) Point?
Translates a point relative to this visual to coordinates that are relative to the specified visual.