VisualExtensions Class
Provides extension methods for the Avalonia.Visual type.
public static class VisualExtensions
- Inheritance:
- object object
Methods
GetFirstFocusableVisualDescendant(Visual?)
Gets the first focusable visual descendant.
public static InputElement? GetFirstFocusableVisualDescendant(this Visual? visual)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual whose descendants will be searched. |
Returns
- InputElement:
The first focusable visual descendant, or
null
if a match could not be found.
GetFirstTabStopVisualDescendant(Visual?)
Gets the first focusable visual descendant that is a tab stop.
public static InputElement? GetFirstTabStopVisualDescendant(this Visual? visual)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual whose descendants will be searched. |
Returns
- InputElement:
The first focusable visual descendant that is a tab stop, or
null
if a match could not be found.
InvalidateMeasureForAllVisualsInSameTemplate(Visual?)
Invalidates measurement of all elements within the same source templated Avalonia.Visual.
public static void InvalidateMeasureForAllVisualsInSameTemplate(this Visual? sourceTemplatedElement)
Parameter | Type | Description |
---|---|---|
sourceTemplatedElement | Visual | The source templated Avalonia.Visual. |
InvalidateMeasureForVisualAncestorPath<PathEndType>(Visual?, bool)
Invalidates measurement from the source visual up to an ancestor of type PathEndType
.
public static void InvalidateMeasureForVisualAncestorPath<PathEndType>(this Visual? source, bool includePathEnd = true)
- Type Parameters:
-
PathEndType
-The ancestor type at which to stop.
Parameter | Type | Description |
---|---|---|
source | Visual | The visual at which to start invalidation. |
includePathEnd | bool | Whether to also invalidate the |
IsFocusWithin(Visual)
Returns whether focus is within the specified visual.
public static bool IsFocusWithin(this Visual visual)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual to examine. |
Returns
- bool:
true
if focus is within the specified visual; otherwise,false
.
See Also
IsFocusWithinAsync(Visual)
Returns a task whose result indicates whether focus is within the specified visual.
public static Task<bool> IsFocusWithinAsync(this Visual visual)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual to examine. |
Returns
See Also
SizeToClient(Visual, PixelSize)
Converts a size from screen pixel units to device independent units.
public static Size SizeToClient(this Visual visual, PixelSize pixelSize)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual. |
pixelSize | PixelSize | The size in screen pixel units. |
Returns
- Size:
The size in device independent units.
SizeToScreen(Visual, Size)
Converts a size from device independent units to screen pixel units.
public static PixelSize SizeToScreen(this Visual visual, Size size)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual. |
size | Size | The size in device independent units. |
Returns
- PixelSize:
The size in screen pixel units.
VectorToClient(Visual, PixelVector)
Converts a vector from screen pixel units to device independent units.
public static Vector VectorToClient(this Visual visual, PixelVector pixelVector)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual. |
pixelVector | PixelVector | The vector in screen pixel units. |
Returns
- Vector:
The vector in device independent units.
VectorToScreen(Visual, Vector)
Converts a vector from device independent units to screen pixel units.
public static PixelVector VectorToScreen(this Visual visual, Vector vector)
Parameter | Type | Description |
---|---|---|
visual | Visual | The visual. |
vector | Vector | The vector in device independent units. |
Returns
- PixelVector:
The vector in screen pixel units.