Summary
Base class for controls that provides rendering and related visual properties.
- Namespace
- Avalonia
- Interfaces
-
- IAvaloniaObjectDebug
- I
Notify Property Changed - IValueSink
- IStyledElement
- IStyleable
- INamed
- IStyleHost
- ILogical
- IResourceHost
- IResourceNode
- IDataContextProvider
- IAvaloniaObject
- ISupportInitialize
- ISetLogicalParent
- I
Set Inheritance Parent - IVisual
- Base Types
- Derived Types
graph BT
Type-->Base0["StyledElement"]
click Base0 "/api/Avalonia/StyledElement"
Base0-->Base1["Animatable"]
click Base1 "/api/Avalonia.Animation/Animatable"
Base1-->Base2["AvaloniaObject"]
click Base2 "/api/Avalonia/AvaloniaObject"
Base2-->Base3["object"]
Type-.->Interface0["IAvaloniaObjectDebug"]
click Interface0 "/api/Avalonia.Diagnostics/IAvaloniaObjectDebug"
Type-.->Interface1["INotifyPropertyChanged"]
Type-.->Interface2["IValueSink"]
Type-.->Interface3["IStyledElement"]
click Interface3 "/api/Avalonia/IStyledElement"
Type-.->Interface4["IStyleable"]
click Interface4 "/api/Avalonia.Styling/IStyleable"
Type-.->Interface5["INamed"]
click Interface5 "/api/Avalonia/INamed"
Type-.->Interface6["IStyleHost"]
click Interface6 "/api/Avalonia.Styling/IStyleHost"
Type-.->Interface7["ILogical"]
click Interface7 "/api/Avalonia.LogicalTree/ILogical"
Type-.->Interface8["IResourceHost"]
click Interface8 "/api/Avalonia.Controls/IResourceHost"
Type-.->Interface9["IResourceNode"]
click Interface9 "/api/Avalonia.Controls/IResourceNode"
Type-.->Interface10["IDataContextProvider"]
click Interface10 "/api/Avalonia/IDataContextProvider"
Type-.->Interface11["IAvaloniaObject"]
click Interface11 "/api/Avalonia/IAvaloniaObject"
Type-.->Interface12["ISupportInitialize"]
Type-.->Interface13["ISetLogicalParent"]
click Interface13 "/api/Avalonia.Controls/ISetLogicalParent"
Type-.->Interface14["ISetInheritanceParent"]
click Interface14 "/api/Avalonia.Controls/ISetInheritanceParent"
Type-.->Interface15["IVisual"]
click Interface15 "/api/Avalonia.VisualTree/IVisual"
Type["Visual"]
class Type type-node
Derived0["Layoutable"]-->Type
click Derived0 "/api/Avalonia.Layout/Layoutable"
Syntax
[UsableDuringInitialization]
public class Visual : StyledElement, IAvaloniaObjectDebug, INotifyPropertyChanged, IValueSink,
IStyledElement, IStyleable, INamed, IStyleHost, ILogical, IResourceHost, IResourceNode,
IDataContextProvider, IAvaloniaObject, ISupportInitialize, ISetLogicalParent,
ISetInheritanceParent, IVisual
Remarks
The
Visual
class represents elements that have a visual on-screen
representation and stores all the information needed for an
IRenderer
to render the control. To traverse the visual tree, use the
extension methods defined in VisualExtensions
.
Attributes
Type | Description |
---|---|
Usable |
Constructors
Events
Name | Type | Summary |
---|---|---|
Attached |
EventHandler |
Raised when the styled element is attached to a rooted logical tree.
Inherited from StyledElement
|
AttachedToVisualTree | EventHandler |
Raised when the control is attached to a rooted visual tree.
|
DataContextChanged | EventHandler? |
Occurs when the
DataContext property changes.
Inherited from StyledElement
|
Detached |
EventHandler |
Raised when the styled element is detached from a rooted logical tree.
Inherited from StyledElement
|
Detached |
EventHandler |
Raised when the control is detached from a rooted visual tree.
|
Initialized | EventHandler? |
Occurs when the styled element has finished initialization.
Inherited from StyledElement
|
PropertyChanged | EventHandler |
Raised when a
AvaloniaProperty value changes on this object.
Inherited from AvaloniaObject
|
ResourcesChanged | EventHandler |
Occurs when a resource in this styled element or a parent styled element has changed.
Inherited from StyledElement
|
Fields
Name | Constant Value | Summary |
---|---|---|
BoundsProperty |
Defines the
Bounds property.
static
|
|
ClipProperty |
Defines the
Clip property.
static
|
|
ClipToBoundsProperty |
Defines the
ClipToBounds property.
static
|
|
ClockProperty |
Defines the
Clock property.
Inherited from Animatable
static
|
|
DataContextProperty |
Defines the
DataContext property.
Inherited from StyledElement
static
|
|
IsVisibleProperty |
Defines the
IsVisibleProperty property.
static
|
|
NameProperty |
Defines the
Name property.
Inherited from StyledElement
static
|
|
OpacityMaskProperty |
Defines the
OpacityMask property.
static
|
|
OpacityProperty |
Defines the
Opacity property.
static
|
|
ParentProperty |
Defines the
Parent property.
Inherited from StyledElement
static
|
|
Render |
Defines the
RenderTransformOrigin property.
static
|
|
Render |
Defines the
RenderTransform property.
static
|
|
Templated |
Defines the
TemplatedParent property.
Inherited from StyledElement
static
|
|
Transformed |
static
|
|
TransitionsProperty |
Defines the
Transitions property.
Inherited from Animatable
static
|
|
VisualParentProperty |
Defines the
VisualParent property.
static
|
|
ZIndexProperty |
Defines the
ZIndex property.
static
|
Properties
Name | Value | Summary |
---|---|---|
Bounds | Rect |
Gets the bounds of the control relative to its parent.
|
Classes | Classes |
Gets or sets the styled element's classes.
Inherited from StyledElement
|
Clip | Geometry |
Gets or sets the geometry clip for this visual.
|
ClipToBounds | bool |
Gets or sets a value indicating whether the control should be clipped to its bounds.
|
Clock | IClock |
Gets or sets the clock which controls the animations on the control.
Inherited from Animatable
|
DataContext | object? |
Gets or sets the control's data context.
Inherited from StyledElement
|
InheritanceParent | IAvaloniaObject |
Gets or sets the parent object that inherited
AvaloniaProperty values
are inherited from.
Inherited from AvaloniaObject
|
IsEffectivelyVisible | bool |
Gets a value indicating whether this control and all its parents are visible.
|
IsInitialized | bool |
Gets a value that indicates whether the element has finished initialization.
Inherited from StyledElement
|
IsVisible | bool |
Gets or sets a value indicating whether this control is visible.
|
LogicalChildren | IAvaloniaList |
Gets the styled element's logical children.
Inherited from StyledElement
|
Name | string? |
Gets or sets the name of the styled element.
Inherited from StyledElement
|
Opacity | double |
Gets or sets the opacity of the control.
|
OpacityMask | IBrush |
Gets or sets the opacity mask of the control.
|
Parent | IStyledElement? |
Gets the styled element's logical parent.
Inherited from StyledElement
|
PseudoClasses | IPseudoClasses |
Gets the
Classes collection in a form that allows adding and removing
pseudoclasses.
Inherited from StyledElement
|
RenderTransform | ITransform |
Gets or sets the render transform of the control.
|
Render |
RelativePoint |
Gets or sets the transform origin of the control.
|
Resources | IResourceDictionary |
Gets or sets the styled element's resource dictionary.
Inherited from StyledElement
|
Styles | Styles |
Gets the styles for the styled element.
Inherited from StyledElement
|
TemplatedParent | ITemplatedControl? |
Gets the styled element whose lookless template this styled element is part of.
Inherited from StyledElement
|
this[ |
object |
Gets or sets the value of a
AvaloniaProperty .
Inherited from AvaloniaObject
|
this[ |
IBinding |
Gets or sets a binding for a
AvaloniaProperty .
Inherited from AvaloniaObject
|
TransformedBounds | TransformedBounds? |
Gets the bounds of the control relative to the window, accounting for rendering transforms.
|
Transitions | Transitions? |
Gets or sets the property transitions for the control.
Inherited from Animatable
|
VisualChildren | IAvaloniaList |
Gets the control's child visuals.
|
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 control.
|
Methods
Extension Methods
Name | Value | Summary |
---|---|---|
Bind |
IDisposable |
Binds a
AvaloniaProperty to an observable.
|
Bind |
IDisposable |
Binds a
AvaloniaProperty to an observable.
|
BindClass |
IDisposable | |
Calculate |
int |
Calculates the distance from a visual's ancestor.
From VisualExtensions
|
Find |
T |
Finds a named element in an
INameScope .
From NameScopeExtensions
|
FindAncestorOfType |
T |
Finds first ancestor of given type.
From VisualExtensions
|
Find |
IVisual |
Tries to get the first common ancestor of two visuals.
From VisualExtensions
|
FindDescendantOfType |
T |
Finds first descendant of given type.
From VisualExtensions
|
Find |
T |
Finds first ancestor of given type.
From LogicalExtensions
|
Find |
T |
Finds first descendant of given type.
From LogicalExtensions
|
FindNameScope |
INameScope |
From NameScopeExtensions
|
FindResource |
object? |
Finds the specified resource by searching up the logical tree and then global styles.
|
Get |
T |
Gets a named element from an
INameScope or throws if no element of the
requested name was found.
From NameScopeExtensions
|
GetBindingObservable |
IObservable |
Gets an observable for a
AvaloniaProperty .
|
GetBindingObservable |
IObservable |
Gets an observable for a
AvaloniaProperty .
|
GetBindingSubject |
ISubject |
Gets a subject for a
AvaloniaProperty .
|
GetBindingSubject |
ISubject |
Gets a subject for a
AvaloniaProperty .
|
GetDiagnostic |
Avalonia |
Gets a diagnostic for a
AvaloniaProperty on a AvaloniaObject .
|
GetLogicalAncestors |
IEnumerable |
Enumerates the ancestors of an
ILogical in the logical tree.
From LogicalExtensions
|
GetLogicalChildren |
IEnumerable |
Enumerates the children of an
ILogical in the logical tree.
From LogicalExtensions
|
Get |
IEnumerable |
Enumerates the descendants of an
ILogical in the logical tree.
From LogicalExtensions
|
GetLogicalParent |
ILogical |
Gets the logical parent of an
ILogical .
From LogicalExtensions
|
GetLogicalParent |
T |
Gets the logical parent of an
ILogical .
From LogicalExtensions
|
GetLogicalSiblings |
IEnumerable |
Enumerates the siblings of an
ILogical in the logical tree.
From LogicalExtensions
|
GetObservable |
IObservable |
Gets an observable for a
AvaloniaProperty .
|
GetObservable |
IObservable |
Gets an observable for a
AvaloniaProperty .
|
Get |
IObservable |
Gets an observable that listens for property changed events for an
AvaloniaProperty .
|
Get |
IObservable |
|
Get |
IEnumerable |
Enumerates an
ILogical and its ancestors in the logical tree.
From LogicalExtensions
|
Get |
IEnumerable |
Enumerates an
ILogical and its descendants in the logical tree.
From LogicalExtensions
|
Get |
IEnumerable |
Enumerates an
IVisual and its ancestors in the visual tree.
From VisualExtensions
|
Get |
IEnumerable |
Enumerates an
IVisual and its descendants in the visual tree.
From VisualExtensions
|
GetStyleDiagnostics |
StyleDiagnostics |
Gets a style diagnostics for a
StyledElement .
|
GetSubject |
ISubject |
Gets a subject for a
AvaloniaProperty .
|
GetSubject |
ISubject |
Gets a subject for a
AvaloniaProperty .
|
GetVisualAncestors |
IEnumerable |
Enumerates the ancestors of an
IVisual in the visual tree.
From VisualExtensions
|
GetVisualAt |
IVisual |
Gets the first visual in the visual tree whose bounds contain a point.
From VisualExtensions
|
GetVisualAt |
IVisual |
Gets the first visual in the visual tree whose bounds contain a point.
From VisualExtensions
|
GetVisualChildren |
IEnumerable |
Enumerates the children of an
IVisual in the visual tree.
From VisualExtensions
|
GetVisualDescendants |
IEnumerable |
Enumerates the descendants of an
IVisual in the visual tree.
From VisualExtensions
|
GetVisualParent |
IVisual |
Gets the visual parent of an
IVisual .
From VisualExtensions
|
GetVisualParent |
T |
Gets the visual parent of an
IVisual .
From VisualExtensions
|
GetVisualRoot |
IRenderRoot |
Gets the root visual for an
IVisual .
From VisualExtensions
|
GetVisualsAt |
IEnumerable |
Enumerates the visible visuals in the visual tree whose bounds contain a point.
From VisualExtensions
|
GetVisualsAt |
IEnumerable |
Enumerates the visuals in the visual tree whose bounds contain a point.
From VisualExtensions
|
HitTestCustom |
bool | |
IsLogicalAncestorOf |
bool |
Tests whether an
ILogical is an ancestor of another logical.
From LogicalExtensions
|
IsVisualAncestorOf |
bool |
Tests whether an
IVisual is an ancestor of another visual.
From VisualExtensions
|
PointToClient |
Point |
Converts a point from screen to client coordinates.
From VisualExtensions
|
PointToScreen |
PixelPoint |
Converts a point from client to screen coordinates.
From VisualExtensions
|
RegisterInNameScope |
T | |
TransformToVisual |
Matrix? |
Returns a transform that transforms the visual's coordinates into the coordinates
of the specified to.
From VisualExtensions
|
TranslatePoint |
Point? |
Translates a point relative to this visual to coordinates that are relative to the specified visual.
From VisualExtensions
|
TryFindResource |
bool |
Tries to the specified resource by searching up the logical tree and then global styles.
|