Class DependencyObjectExtensions
Extensions for DependencyObjects
Namespace: Sartorius.SAF.Presentation.Extensions
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public static class DependencyObjectExtensions
Methods
View SourceFindAncestor<T>(DependencyObject)
Finds the ancestor of the specified type in the visual tree.
Declaration
public static T FindAncestor<T>(this DependencyObject dependencyObject) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | dependencyObject | The dependency object. |
Returns
| Type | Description |
|---|---|
| T | The ancestor of the specified type, or null if not found |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the ancestor |
FindFirstChildByType<T>(DependencyObject)
Finds the first child of type.
Declaration
public static T FindFirstChildByType<T>(this DependencyObject parent) where T : DependencyObject
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | parent | The parent. |
Returns
| Type | Description |
|---|---|
| T | Null if not found, otherwise the child |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the child to find |
FindLogicalAncestor<T>(DependencyObject)
Finds the ancestor of the specified type in the logical tree.
Declaration
public static T FindLogicalAncestor<T>(this DependencyObject dependencyObject) where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | dependencyObject | The dependency object. |
Returns
| Type | Description |
|---|---|
| T | The ancestor of the specified type, or null if not found |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the ancestor |
GetChildrenByType<T>(DependencyObject)
Finds the children of the specified type.
Declaration
public static IEnumerable<T> GetChildrenByType<T>(this DependencyObject parent) where T : DependencyObject
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | parent | The parent. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | Empty if not found, otherwise the children |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the children to find. |
GetContainer(DependencyObject)
Gets the value of the Sartorius.SAF.Presentation.Extensions.Composition.Container attached property from a given DependencyObject.
Declaration
public static CompositionContainer GetContainer(this DependencyObject element)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | element | The element from which to read the property value. |
Returns
| Type | Description |
|---|---|
| CompositionContainer | The value of the Sartorius.SAF.Presentation.Extensions.Composition.Container attached property. |
SetContainer(DependencyObject, CompositionContainer)
Sets the value of the Sartorius.SAF.Presentation.Extensions.Composition.Container attached property to a given DependencyObject.
Declaration
public static void SetContainer(this DependencyObject element, CompositionContainer value)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | element | The element on which to set the attached property. |
| CompositionContainer | value | The property value to set. |
XamlClone<T>(T)
Creates a xaml clone of the wpf element.
Declaration
public static T XamlClone<T>(this T original) where T : DependencyObject
Parameters
| Type | Name | Description |
|---|---|---|
| T | original | The wpf element to clone. |
Returns
| Type | Description |
|---|---|
| T | The clone. |
Type Parameters
| Name | Description |
|---|---|
| T | The wpf element type. |