Class HelperExtensions
Collection of extension methods e.g. visual tree traversal
Inheritance
HelperExtensions
Assembly: BionicCode.Utilities.Net.Wpf.dll
Syntax
public static class HelperExtensions
Methods
|
Improve this Doc
View Source
CloneElement(UIElement)
Declaration
public static UIElement CloneElement(this UIElement elementToClone)
Parameters
| Type |
Name |
Description |
| UIElement |
elementToClone |
|
Returns
| Type |
Description |
| UIElement |
A clone of the elementToClone instance.
|
|
Improve this Doc
View Source
EnumerateVisualChildElements<TChildren>(DependencyObject)
Traverses the visual tree towards the leafs until all elements with a matching element type is found.
Returns an IEnumerable<T> to enable deferred traversal.
Declaration
public static IEnumerable<TChildren> EnumerateVisualChildElements<TChildren>(this DependencyObject parent)
where TChildren : DependencyObject
Parameters
Returns
| Type |
Description |
| IEnumerable<TChildren> |
An enumerable collection of matching visual child elements.
|
Type Parameters
| Name |
Description |
| TChildren |
The type the visual children must match.
|
|
Improve this Doc
View Source
GetExtremePoints(IEnumerable<Point>)
Declaration
public static (Point MaxX, Point MinX, Point MaxY, Point MinY) GetExtremePoints(this IEnumerable<Point> points)
Parameters
Returns
|
Improve this Doc
View Source
ToCartesianPoint(Point, Double)
Declaration
public static Point ToCartesianPoint(this Point cartesianPoint, double height)
Parameters
| Type |
Name |
Description |
| Point |
cartesianPoint |
|
| Double |
height |
|
Returns
|
Improve this Doc
View Source
ToDegrees(Double)
Declaration
public static double ToDegrees(this double angleRadians)
Parameters
| Type |
Name |
Description |
| Double |
angleRadians |
|
Returns
|
Improve this Doc
View Source
ToRadians(Double)
Declaration
public static double ToRadians(this double angleDegrees)
Parameters
| Type |
Name |
Description |
| Double |
angleDegrees |
|
Returns
|
Improve this Doc
View Source
ToScreenPoint(Point, Double)
Declaration
public static Point ToScreenPoint(this Point cartesianPoint, double yAxisPositiveLimit)
Parameters
| Type |
Name |
Description |
| Point |
cartesianPoint |
|
| Double |
yAxisPositiveLimit |
|
Returns
|
Improve this Doc
View Source
TryAssignValue(FrameworkElement, Object)
Tries to add a value to the visual tree of an unknown FrameworkElement. For example if the element is a TextBlock the value is assigned to the Text property.
Declaration
public static bool TryAssignValue(this FrameworkElement frameworkElement, object value)
Parameters
Returns
| Type |
Description |
| Boolean |
true if the assignment was succesful. Otherwise false.
|
|
Improve this Doc
View Source
TryFindVisualChildElement<TChild>(DependencyObject, out TChild)
Traverses the visual tree towards the leafs until an element with a matching element type is found.
Declaration
public static bool TryFindVisualChildElement<TChild>(this DependencyObject parent, out TChild resultElement)
where TChild : DependencyObject
Parameters
Returns
Type Parameters
| Name |
Description |
| TChild |
The type the visual child must match.
|
|
Improve this Doc
View Source
TryFindVisualChildElementByName<TChild>(DependencyObject, String, out TChild)
Traverses the visual tree towards the leafs until an element with a matching element name is found.
Declaration
public static bool TryFindVisualChildElementByName<TChild>(this DependencyObject parent, string childElementName, out TChild resultElement)
where TChild : FrameworkElement
Parameters
| Type |
Name |
Description |
| DependencyObject |
parent |
|
| String |
childElementName |
The name the visual child's name must match.
|
| TChild |
resultElement |
The found element or null if no matching element was found.
|
Returns
| Type |
Description |
| Boolean |
true when an element with the specified childElementName was found, otherwise false.
|
Type Parameters
|
Improve this Doc
View Source
TryFindVisualParentElement<TParent>(DependencyObject, out TParent)
Traverses the visual tree towards the root until an element with a matching element name is found.
Declaration
public static bool TryFindVisualParentElement<TParent>(this DependencyObject child, out TParent resultElement)
where TParent : DependencyObject
Parameters
Returns
Type Parameters
| Name |
Description |
| TParent |
The type the visual parent must match.
|
|
Improve this Doc
View Source
TryFindVisualParentElementByName<TChild>(DependencyObject, String, out TChild)
Traverses the visual tree towards the root until an element with a matching element type is found.
Declaration
public static bool TryFindVisualParentElementByName<TChild>(this DependencyObject child, string elementName, out TChild resultElement)
where TChild : FrameworkElement
Parameters
| Type |
Name |
Description |
| DependencyObject |
child |
|
| String |
elementName |
The element name the visual parent must match.
|
| TChild |
resultElement |
|
Returns
Type Parameters