In This Article

OrientedElementExtensions Class

Provides extension methods for the IOrientedElement type.

public static class OrientedElementExtensions
Inheritance:
object object

Remarks

Many of the methods refer to the terms 'extent' and 'ascent'. For elements with horizontal orientation, the extent is along the x-axis and the the ascent is along the y-axis. Conversely, for elements with vertical orientation, the ascent is along the x-axis and the the extent is along the y-axis.

Methods

CreatePoint(IOrientedElement, double, double)

Creates a Avalonia.Point comprised of the specified extent and ascent locations.

public static Point CreatePoint(this IOrientedElement element, double extentLocation, double ascentLocation)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

extentLocation double

The extent location.

ascentLocation double

The ascent location.

Returns

Point:

The Avalonia.Point that was created.

Remarks

For horizontal orientation, the X location will be the extent location and the Y location will be the ascent location. For vertical orientation, the X location will be the ascent location and the Y location will be the extent location.

CreateRect(IOrientedElement, double, double, double, double)

Creates a Avalonia.Rect comprised of the specified extent and ascent locations/lengths.

public static Rect CreateRect(this IOrientedElement element, double extentLocation, double ascentLocation, double extentLength, double ascentLength)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

extentLocation double

The extent location.

ascentLocation double

The ascent location.

extentLength double

The extent length.

ascentLength double

The ascent length.

Returns

Rect:

The Avalonia.Rect that was created.

Remarks

For horizontal orientation, the X location will be the extent location, the Y location will be the ascent location, the width will be the extent length, and the height will be the ascent length For vertical orientation, the X location will be the ascent location, the Y location will be the extent location, the width will be the ascent length, and the height will be the extent length

CreateSize(IOrientedElement, double, double)

Creates a Avalonia.Size comprised of the specified extent and ascent lengths.

public static Size CreateSize(this IOrientedElement element, double extentLength, double ascentLength)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

extentLength double

The extent length.

ascentLength double

The ascent length.

Returns

Size:

The Avalonia.Size that was created.

Remarks

For horizontal orientation, the width will be the extent length and the height will be the ascent length. For vertical orientation, the width will be the ascent length and the height will be the extent length.

GetLocationAscent(IOrientedElement, Point)

Returns the location ascent of the specified Avalonia.Point, based on the orientation of the element.

public static double GetLocationAscent(this IOrientedElement element, Point location)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

location Point

The Avalonia.Point to examine.

Returns

double:

The location ascent of the specified Avalonia.Point, based on the orientation of the element.

Remarks

For horizontal orientation, the ascent will be the Y value. For vertical orientation, the ascent will be the X value.

GetLocationAscent(IOrientedElement, Rect)

Returns the location ascent of the specified Avalonia.Rect, based on the orientation of the element.

public static double GetLocationAscent(this IOrientedElement element, Rect bounds)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

bounds Rect

The Avalonia.Rect to examine.

Returns

double:

The ascent of the specified Avalonia.Rect, based on the orientation of the element.

Remarks

For horizontal orientation, the ascent will be the Y value. For vertical orientation, the ascent will be the X value.

GetLocationAscent(IOrientedElement, Vector)

Returns the location ascent of the specified Avalonia.Vector, based on the orientation of the element.

public static double GetLocationAscent(this IOrientedElement element, Vector location)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

location Vector

The Avalonia.Vector to examine.

Returns

double:

The location ascent of the specified Avalonia.Vector, based on the orientation of the element.

Remarks

For horizontal orientation, the ascent will be the Y value. For vertical orientation, the ascent will be the X value.

GetLocationExtent(IOrientedElement, Point)

Returns the location extent of the specified Avalonia.Point, based on the orientation of the element.

public static double GetLocationExtent(this IOrientedElement element, Point location)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

location Point

The Avalonia.Point to examine.

Returns

double:

The location extent of the specified Avalonia.Point, based on the orientation of the element.

Remarks

For horizontal orientation, the extent will be the X value. For vertical orientation, the extent will be the Y value.

GetLocationExtent(IOrientedElement, Rect)

Returns the location extent of the specified Avalonia.Rect, based on the orientation of the element.

public static double GetLocationExtent(this IOrientedElement element, Rect bounds)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

bounds Rect

The Avalonia.Rect to examine.

Returns

double:

The location extent of the specified Avalonia.Rect, based on the orientation of the element.

Remarks

For horizontal orientation, the extent will be the X value. For vertical orientation, the extent will be the Y value.

GetLocationExtent(IOrientedElement, Vector)

Returns the location extent of the specified Avalonia.Vector, based on the orientation of the element.

public static double GetLocationExtent(this IOrientedElement element, Vector location)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

location Vector

The Avalonia.Vector to examine.

Returns

double:

The location extent of the specified Avalonia.Vector, based on the orientation of the element.

Remarks

For horizontal orientation, the extent will be the X value. For vertical orientation, the extent will be the Y value.

GetOrientedValue<T>(IOrientedElement, Func<T>, Func<T>)

Returns the appropriate value based on the orientation of the element.

public static T GetOrientedValue<T>(this IOrientedElement element, Func<T> horizontalValueFactory, Func<T> verticalValueFactory)
Type Parameters:
T -

The type of value to be returned.

Parameter Type Description
element IOrientedElement

The element with orientation to examine.

horizontalValueFactory Func<T>

The factory method which will provide the value for horizontally-oriented elements.

verticalValueFactory Func<T>

The factory method which will provide the value for vertically-oriented elements.

Returns

T:

the value returned by horizontalValueFactory or verticalValueFactory, based on the orientation of the element.

GetOrientedValue<T>(IOrientedElement, T, T)

Returns the appropriate value based on the orientation of the element.

public static T GetOrientedValue<T>(this IOrientedElement element, T horizontalValue, T verticalValue)
Type Parameters:
T -

The type of value to be returned.

Parameter Type Description
element IOrientedElement

The element with orientation to examine.

horizontalValue T

The value to return for horizontally-oriented elements.

verticalValue T

The value to return for vertically-oriented elements.

Returns

T:

The horizontalValue or verticalValue, based on the orientation of the element.

GetPoint(IOrientedElement, double, double)

Returns a new point with the specified extent and ascent, based on the orientation of the element.

public static Point GetPoint(this IOrientedElement element, double extent, double ascent)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

extent double

The extent of the point, based on the orientation of the element.

ascent double

The ascent of the point, based on the orientation of the element.

Returns

Point:

a new Avalonia.Point, based on the orientation of the element.

Remarks

For horizontal orientation, the X coordinate will be the extent and the Y coordinate will be the ascent. For vertical orientation, the X coordinate will be the ascent and the Y coordinate will be the extent.

GetSizeAscent(IOrientedElement, Rect)

Returns the size ascent of the specified Avalonia.Rect, based on the orientation of the element.

public static double GetSizeAscent(this IOrientedElement element, Rect bounds)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

bounds Rect

The Avalonia.Rect to examine.

Returns

double:

The size ascent of the specified Avalonia.Rect, based on the orientation of the element.

Remarks

For horizontal orientation, the ascent will be the height. For vertical orientation, the ascent will be the width.

GetSizeAscent(IOrientedElement, Size)

Returns the size ascent of the specified Avalonia.Size, based on the orientation of the element.

public static double GetSizeAscent(this IOrientedElement element, Size size)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

size Size

The Avalonia.Size to examine.

Returns

double:

The size ascent of the specified Avalonia.Size, based on the orientation of the element.

Remarks

For horizontal orientation, the ascent will be the height. For vertical orientation, the ascent will be the width.

GetSizeExtent(IOrientedElement, Rect)

Returns the size extent of the specified Avalonia.Rect, based on the orientation of the element.

public static double GetSizeExtent(this IOrientedElement element, Rect bounds)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

bounds Rect

The Avalonia.Rect to examine.

Returns

double:

The size extent of the specified Avalonia.Rect, based on the orientation of the element.

Remarks

For horizontal orientation, the extent will be the width. For vertical orientation, the extent will be the height.

GetSizeExtent(IOrientedElement, Size)

Returns the size extent of the specified Avalonia.Size, based on the orientation of the element.

public static double GetSizeExtent(this IOrientedElement element, Size size)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

size Size

The Avalonia.Size to examine.

Returns

double:

The size extent of the specified Avalonia.Size, based on the orientation of the element.

Remarks

For horizontal orientation, the extent will be the width. For vertical orientation, the extent will be the height.

GetThicknessFarAscent(IOrientedElement, Thickness)

Returns the far side ascent of the specified Avalonia.Thickness, based on the orientation of the element.

public static double GetThicknessFarAscent(this IOrientedElement element, Thickness thickness)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

thickness Thickness

The Avalonia.Thickness to examine.

Returns

double:

the far side ascent of the specified Avalonia.Thickness, based on the orientation of the element.

Remarks

For horizontal orientation, the far ascent will be the Avalonia.Thickness.Bottom value. For vertical orientation, the far ascent will be the Avalonia.Thickness.Right value.

GetThicknessFarExtent(IOrientedElement, Thickness)

Returns the far side extent of the specified Avalonia.Thickness, based on the orientation of the element.

public static double GetThicknessFarExtent(this IOrientedElement element, Thickness thickness)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

thickness Thickness

The Avalonia.Thickness to examine.

Returns

double:

the far side extent of the specified Avalonia.Thickness, based on the orientation of the element.

Remarks

For horizontal orientation, the far extent will be the Avalonia.Thickness.Right value. For vertical orientation, the far extent will be the Avalonia.Thickness.Bottom value.

GetThicknessNearAscent(IOrientedElement, Thickness)

Returns the near side ascent of the specified Avalonia.Thickness, based on the orientation of the element.

public static double GetThicknessNearAscent(this IOrientedElement element, Thickness thickness)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

thickness Thickness

The Avalonia.Thickness to examine.

Returns

double:

the near side ascent of the specified Avalonia.Thickness, based on the orientation of the element.

Remarks

For horizontal orientation, the near ascent will be the Avalonia.Thickness.Top value. For vertical orientation, the near ascent will be the Avalonia.Thickness.Left value.

GetThicknessNearExtent(IOrientedElement, Thickness)

Returns the near side extent of the specified Avalonia.Thickness, based on the orientation of the element.

public static double GetThicknessNearExtent(this IOrientedElement element, Thickness thickness)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

thickness Thickness

The Avalonia.Thickness to examine.

Returns

double:

the near side extent of the specified Avalonia.Thickness, based on the orientation of the element.

Remarks

For horizontal orientation, the far extent will be the Avalonia.Thickness.Left value. For vertical orientation, the far extent will be the Avalonia.Thickness.Top value.

PerformOrientedAction(IOrientedElement, Action, Action)

Performs an action based on the orientation of the element.

public static void PerformOrientedAction(this IOrientedElement element, Action horizontalAction, Action verticalAction)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

horizontalAction Action

The action to be performed for a horizontally-oriented element.

verticalAction Action

The action to be performed for a vertically-oriented element.

Inherited Members