IVisual Interface

Summary

Represents control that has a visual on-screen representation.
graph TD Type["IVisual"] class Type type-node Type-.->Implementing0["ListBoxItem"] click Implementing0 "/api/Avalonia.Controls/ListBoxItem" Type-.->Implementing1["MenuItem"] click Implementing1 "/api/Avalonia.Controls/MenuItem" Type-.->Implementing2["IControl"] click Implementing2 "/api/Avalonia.Controls/IControl" Type-.->Implementing3["Canvas"] click Implementing3 "/api/Avalonia.Controls/Canvas" Type-.->Implementing4["ProgressBar"] click Implementing4 "/api/Avalonia.Controls/ProgressBar" Type-.->Implementing5["ILayoutable"] click Implementing5 "/api/Avalonia.Layout/ILayoutable" Type-.->Implementing6["AccessText"] click Implementing6 "/api/Avalonia.Controls.Primitives/AccessText" Type-.->Implementing7["IInputElement"] click Implementing7 "/api/Avalonia.Input/IInputElement" Type-.->Implementing8["HeaderedSelectingItemsControl"] click Implementing8 "/api/Avalonia.Controls.Primitives/HeaderedSelectingItemsControl" Type-.->Implementing9["Control"] click Implementing9 "/api/Avalonia.Controls/Control" Type-.->Implementing10["ContextMenu"] click Implementing10 "/api/Avalonia.Controls/ContextMenu" Type-.->Implementing11["Grid"] click Implementing11 "/api/Avalonia.Controls/Grid" Type-.->Implementing12["RemoteWidget"] click Implementing12 "/api/Avalonia.Controls.Remote/RemoteWidget" Type-.->Implementing13["Separator"] click Implementing13 "/api/Avalonia.Controls/Separator" Type-.->Implementing14["TabItem"] click Implementing14 "/api/Avalonia.Controls/TabItem" Type-.->Implementing15["DropDown"] click Implementing15 "/api/Avalonia.Controls/DropDown" Type-.->Implementing16["ToolTip"] click Implementing16 "/api/Avalonia.Controls/ToolTip" Type-.->Implementing17["RangeBase"] click Implementing17 "/api/Avalonia.Controls.Primitives/RangeBase" Type-.->Implementing18["ItemsPresenterBase"] click Implementing18 "/api/Avalonia.Controls.Presenters/ItemsPresenterBase" Type-.->Implementing19["Popup"] click Implementing19 "/api/Avalonia.Controls.Primitives/Popup" Type-.->Implementing20["IPanel"] click Implementing20 "/api/Avalonia.Controls/IPanel" Type-.->Implementing21["Layoutable"] click Implementing21 "/api/Avalonia.Layout/Layoutable" Type-.->Implementing22["DataValidationErrors"] click Implementing22 "/api/Avalonia.Controls/DataValidationErrors" Type-.->Implementing23["DockPanel"] click Implementing23 "/api/Avalonia.Controls/DockPanel" Type-.->Implementing24["TextBlock"] click Implementing24 "/api/Avalonia.Controls/TextBlock" Type-.->Implementing25["IVirtualizingPanel"] click Implementing25 "/api/Avalonia.Controls/IVirtualizingPanel" Type-.->Implementing26["Button"] click Implementing26 "/api/Avalonia.Controls/Button" Type-.->Implementing27["EmbeddableControlRoot"] click Implementing27 "/api/Avalonia.Controls.Embedding/EmbeddableControlRoot" Type-.->Implementing28["Carousel"] click Implementing28 "/api/Avalonia.Controls/Carousel" Type-.->Implementing29["CarouselPresenter"] click Implementing29 "/api/Avalonia.Controls.Presenters/CarouselPresenter" Type-.->Implementing30["CalendarDayButton"] click Implementing30 "/api/Avalonia.Controls.Primitives/CalendarDayButton" Type-.->Implementing31["InputElement"] click Implementing31 "/api/Avalonia.Input/InputElement" Type-.->Implementing32["HeaderedItemsControl"] click Implementing32 "/api/Avalonia.Controls.Primitives/HeaderedItemsControl" Type-.->Implementing33["ScrollViewer"] click Implementing33 "/api/Avalonia.Controls/ScrollViewer" Type-.->Implementing34["TreeView"] click Implementing34 "/api/Avalonia.Controls/TreeView" Type-.->Implementing35["IEmbeddedLayoutRoot"] click Implementing35 "/api/Avalonia.Layout/IEmbeddedLayoutRoot" Type-.->Implementing36["ILayoutRoot"] click Implementing36 "/api/Avalonia.Layout/ILayoutRoot" Type-.->Implementing37["AdornerDecorator"] click Implementing37 "/api/Avalonia.Controls.Primitives/AdornerDecorator" Type-.->Implementing38["WindowBase"] click Implementing38 "/api/Avalonia.Controls/WindowBase" Type-.->Implementing39["VirtualizingStackPanel"] click Implementing39 "/api/Avalonia.Controls/VirtualizingStackPanel" Type-.->Implementing40["IRenderRoot"] click Implementing40 "/api/Avalonia.Rendering/IRenderRoot" Type-.->Implementing41["SimpleGrid"] click Implementing41 "/api/Avalonia.Diagnostics.Views/SimpleGrid" Type-.->Implementing42["HtmlControl"] click Implementing42 "/api/Avalonia.Controls.Html/HtmlControl" Type-.->Implementing43["ScrollContentPresenter"] click Implementing43 "/api/Avalonia.Controls.Presenters/ScrollContentPresenter" Type-.->Implementing44["Slider"] click Implementing44 "/api/Avalonia.Controls/Slider" Type-.->Implementing45["TabStripItem"] click Implementing45 "/api/Avalonia.Controls.Primitives/TabStripItem" Type-.->Implementing46["Calendar"] click Implementing46 "/api/Avalonia.Controls/Calendar" Type-.->Implementing47["IContentControl"] click Implementing47 "/api/Avalonia.Controls/IContentControl" Type-.->Implementing48["RadioButton"] click Implementing48 "/api/Avalonia.Controls/RadioButton" Type-.->Implementing49["TemplatedControl"] click Implementing49 "/api/Avalonia.Controls.Primitives/TemplatedControl" Type-.->Implementing50["Ellipse"] click Implementing50 "/api/Avalonia.Controls.Shapes/Ellipse" Type-.->Implementing51["IItemsPresenter"] click Implementing51 "/api/Avalonia.Controls.Presenters/IItemsPresenter" Type-.->Implementing52["LayoutTransformControl"] click Implementing52 "/api/Avalonia.Controls/LayoutTransformControl" Type-.->Implementing53["Path"] click Implementing53 "/api/Avalonia.Controls.Shapes/Path" Type-.->Implementing54["CalendarItem"] click Implementing54 "/api/Avalonia.Controls.Primitives/CalendarItem" Type-.->Implementing55["Track"] click Implementing55 "/api/Avalonia.Controls.Primitives/Track" Type-.->Implementing56["Window"] click Implementing56 "/api/Avalonia.Controls/Window" Type-.->Implementing57["DropDownItem"] click Implementing57 "/api/Avalonia.Controls/DropDownItem" Type-.->Implementing58["TextPresenter"] click Implementing58 "/api/Avalonia.Controls.Presenters/TextPresenter" Type-.->Implementing59["HeaderedContentControl"] click Implementing59 "/api/Avalonia.Controls.Primitives/HeaderedContentControl" Type-.->Implementing60["SelectingItemsControl"] click Implementing60 "/api/Avalonia.Controls.Primitives/SelectingItemsControl" Type-.->Implementing61["Decorator"] click Implementing61 "/api/Avalonia.Controls/Decorator" Type-.->Implementing62["TextBox"] click Implementing62 "/api/Avalonia.Controls/TextBox" Type-.->Implementing63["TopLevel"] click Implementing63 "/api/Avalonia.Controls/TopLevel" Type-.->Implementing64["IContentPresenter"] click Implementing64 "/api/Avalonia.Controls.Presenters/IContentPresenter" Type-.->Implementing65["TabControl"] click Implementing65 "/api/Avalonia.Controls/TabControl" Type-.->Implementing66["ItemsControl"] click Implementing66 "/api/Avalonia.Controls/ItemsControl" Type-.->Implementing67["Visual"] click Implementing67 "/api/Avalonia/Visual" Type-.->Implementing68["Thumb"] click Implementing68 "/api/Avalonia.Controls.Primitives/Thumb" Type-.->Implementing69["ScrollBar"] click Implementing69 "/api/Avalonia.Controls.Primitives/ScrollBar" Type-.->Implementing70["ToggleButton"] click Implementing70 "/api/Avalonia.Controls.Primitives/ToggleButton" Type-.->Implementing71["ContentPresenter"] click Implementing71 "/api/Avalonia.Controls.Presenters/ContentPresenter" Type-.->Implementing72["Border"] click Implementing72 "/api/Avalonia.Controls/Border" Type-.->Implementing73["UserControl"] click Implementing73 "/api/Avalonia.Controls/UserControl" Type-.->Implementing74["IMainMenu"] click Implementing74 "/api/Avalonia.Input/IMainMenu" Type-.->Implementing75["AdornerLayer"] click Implementing75 "/api/Avalonia.Controls.Primitives/AdornerLayer" Type-.->Implementing76["DrawingPresenter"] click Implementing76 "/api/Avalonia.Controls/DrawingPresenter" Type-.->Implementing77["TreeViewItem"] click Implementing77 "/api/Avalonia.Controls/TreeViewItem" Type-.->Implementing78["GridSplitter"] click Implementing78 "/api/Avalonia.Controls/GridSplitter" Type-.->Implementing79["IPresenter"] click Implementing79 "/api/Avalonia.Controls.Presenters/IPresenter" Type-.->Implementing80["StackPanel"] click Implementing80 "/api/Avalonia.Controls/StackPanel" Type-.->Implementing81["IInputRoot"] click Implementing81 "/api/Avalonia.Input/IInputRoot" Type-.->Implementing82["ItemsPresenter"] click Implementing82 "/api/Avalonia.Controls.Presenters/ItemsPresenter" Type-.->Implementing83["Image"] click Implementing83 "/api/Avalonia.Controls/Image" Type-.->Implementing84["DevTools"] click Implementing84 "/api/Avalonia.Diagnostics/DevTools" Type-.->Implementing85["ContentControl"] click Implementing85 "/api/Avalonia.Controls/ContentControl" Type-.->Implementing86["Polygon"] click Implementing86 "/api/Avalonia.Controls.Shapes/Polygon" Type-.->Implementing87["TreePageView"] click Implementing87 "/api/Avalonia.Diagnostics.Views/TreePageView" Type-.->Implementing88["Rectangle"] click Implementing88 "/api/Avalonia.Controls.Shapes/Rectangle" Type-.->Implementing89["Expander"] click Implementing89 "/api/Avalonia.Controls/Expander" Type-.->Implementing90["WrapPanel"] click Implementing90 "/api/Avalonia.Controls/WrapPanel" Type-.->Implementing91["Panel"] click Implementing91 "/api/Avalonia.Controls/Panel" Type-.->Implementing92["CheckBox"] click Implementing92 "/api/Avalonia.Controls/CheckBox" Type-.->Implementing93["HtmlLabel"] click Implementing93 "/api/Avalonia.Controls.Html/HtmlLabel" Type-.->Implementing94["Polyline"] click Implementing94 "/api/Avalonia.Controls.Shapes/Polyline" Type-.->Implementing95["ListBox"] click Implementing95 "/api/Avalonia.Controls/ListBox" Type-.->Implementing96["RepeatButton"] click Implementing96 "/api/Avalonia.Controls/RepeatButton" Type-.->Implementing97["CalendarButton"] click Implementing97 "/api/Avalonia.Controls.Primitives/CalendarButton" Type-.->Implementing98["Menu"] click Implementing98 "/api/Avalonia.Controls/Menu" Type-.->Implementing99["Shape"] click Implementing99 "/api/Avalonia.Controls.Shapes/Shape" Type-.->Implementing100["Interactive"] click Implementing100 "/api/Avalonia.Interactivity/Interactive" Type-.->Implementing101["PopupRoot"] click Implementing101 "/api/Avalonia.Controls.Primitives/PopupRoot" Type-.->Implementing102["TabStrip"] click Implementing102 "/api/Avalonia.Controls.Primitives/TabStrip" Type-.->Implementing103["Line"] click Implementing103 "/api/Avalonia.Controls.Shapes/Line"

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<TEventArgs>
Raised when the control is attached to a rooted visual tree.
DetachedFromVisualTree EventHandler<TEventArgs>
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 Nullable<T>
Gets the bounds of the control relative to the window, accounting for rendering transforms.
VisualChildren IAvaloniaReadOnlyList<T>
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.
TransformToVisual(IVisual) Nullable<T>
Returns a transform that transforms the visual's coordinates into the coordinates of the specified visual.

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<T>
Enumerates an IVisual and its ancestors in the visual tree.
GetSelfAndVisualDescendants() IEnumerable<T>
Enumerates an IVisual and its descendants in the visual tree.
GetVisualAncestors() IEnumerable<T>
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<T>
Enumerates the children of an IVisual in the visual tree.
GetVisualDescendants() IEnumerable<T>
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<T>
Enumerates the visible visuals in the visual tree whose bounds contain a point.
GetVisualsAt(Point, Func<IVisual, bool>) IEnumerable<T>
Enumerates the visuals in the visual tree whose bounds contain a point.
IsVisualAncestorOf(IVisual) bool
Tests whether an IVisual is an ancestor of another visual.
PointToClient(Point) Point
Converts a point from screen to client coordinates.
PointToScreen(Point) Point
Converts a point from client to screen coordinates.
TranslatePoint(Point, IVisual) Point
Translates a point relative to this visual to coordinates that are relative to the specified visual. The visual and relativeTo should be descendants of the same root window