In This Article

OrientedElementExtensions Class

Provides extension methods for the type IOrientedElement.

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 System.Windows.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 System.Windows.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 System.Windows.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 System.Windows.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 System.Windows.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 System.Windows.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.

GetDragChangeAscent(IOrientedElement, DragCompletedEventArgs)

Returns the ascent change amount of the specified DragCompletedEventArgs, based on the orientation of the element.

public static double GetDragChangeAscent(this IOrientedElement element, DragCompletedEventArgs dragCompletedEventArgs)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

dragCompletedEventArgs DragCompletedEventArgs

The DragCompletedEventArgs to examine.

Returns

double:

the ascent change amount of the specified DragCompletedEventArgs, based on the orientation of the element.

Remarks

For horizontal orientation, the ascent will be the VerticalChange value. For vertical orientation, the ascent will be the HorizontalChange value.

GetDragChangeAscent(IOrientedElement, DragDeltaEventArgs)

Returns the ascent change amount of the specified DragDeltaEventArgs, based on the orientation of the element.

public static double GetDragChangeAscent(this IOrientedElement element, DragDeltaEventArgs dragDeltaEventArgs)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

dragDeltaEventArgs DragDeltaEventArgs

The DragDeltaEventArgs to examine.

Returns

double:

the ascent change amount of the specified DragDeltaEventArgs, based on the orientation of the element.

Remarks

For horizontal orientation, the ascent will be the VerticalChange value. For vertical orientation, the ascent will be the HorizontalChange value.

GetDragChangeExtent(IOrientedElement, DragCompletedEventArgs)

Returns the extent change amount of the specified DragCompletedEventArgs, based on the orientation of the element.

public static double GetDragChangeExtent(this IOrientedElement element, DragCompletedEventArgs dragCompletedEventArgs)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

dragCompletedEventArgs DragCompletedEventArgs

The DragCompletedEventArgs to examine.

Returns

double:

the extent change amount of the specified DragCompletedEventArgs, based on the orientation of the element.

Remarks

For horizontal orientation, the extent will be the HorizontalChange value. For vertical orientation, the extent will be the VerticalChange value.

GetDragChangeExtent(IOrientedElement, DragDeltaEventArgs)

Returns the extent change amount of the specified DragDeltaEventArgs, based on the orientation of the element.

public static double GetDragChangeExtent(this IOrientedElement element, DragDeltaEventArgs dragDeltaEventArgs)
Parameter Type Description
element IOrientedElement

The element with orientation to examine.

dragDeltaEventArgs DragDeltaEventArgs

The DragDeltaEventArgs to examine.

Returns

double:

the extent change amount of the specified DragDeltaEventArgs, based on the orientation of the element.

Remarks

For horizontal orientation, the extent will be the HorizontalChange value. For vertical orientation, the extent will be the VerticalChange value.

GetLocationAscent(IOrientedElement, Point)

Returns the location ascent of the specified System.Windows.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 System.Windows.Point to examine.

Returns

double:

The location ascent of the specified System.Windows.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 System.Windows.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 System.Windows.Rect to examine.

Returns

double:

The ascent of the specified System.Windows.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.

GetLocationExtent(IOrientedElement, Point)

Returns the location extent of the specified System.Windows.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 System.Windows.Point to examine.

Returns

double:

The location extent of the specified System.Windows.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 System.Windows.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 System.Windows.Rect to examine.

Returns

double:

The location extent of the specified System.Windows.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.

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 System.Windows.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 System.Windows.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 System.Windows.Rect to examine.

Returns

double:

The size ascent of the specified System.Windows.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 System.Windows.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 System.Windows.Size to examine.

Returns

double:

The size ascent of the specified System.Windows.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 System.Windows.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 System.Windows.Rect to examine.

Returns

double:

The size extent of the specified System.Windows.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 System.Windows.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 System.Windows.Size to examine.

Returns

double:

The size extent of the specified System.Windows.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 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 Thickness to examine.

Returns

double:

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

Remarks

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

GetThicknessFarExtent(IOrientedElement, Thickness)

Returns the far side extent of the specified 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 Thickness to examine.

Returns

double:

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

Remarks

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

GetThicknessNearAscent(IOrientedElement, Thickness)

Returns the near side ascent of the specified 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 Thickness to examine.

Returns

double:

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

Remarks

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

GetThicknessNearExtent(IOrientedElement, Thickness)

Returns the near side extent of the specified 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 Thickness to examine.

Returns

double:

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

Remarks

For horizontal orientation, the far extent will be the Left value. For vertical orientation, the far extent will be the 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