Class DependencyObjectExtensions
Extensions for DependencyObjects
Inheritance
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 |
---|---|---|
System.Windows.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 |
---|---|---|
System.Windows.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 |
---|---|---|
System.Windows.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 |
---|---|---|
System.Windows.DependencyObject | parent | The parent. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Empty if not found, otherwise the children |
Type Parameters
Name | Description |
---|---|
T | The type of the children to find. |
GetChildsByType<T>(DependencyObject, List<T>)
Finds the children of type.
Declaration
[Obsolete("Use GetChildrenByType instead.")]
public static List<T> GetChildsByType<T>(this DependencyObject parent, List<T> emptyList)
where T : DependencyObject
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | parent | The parent. |
System.Collections.Generic.List<T> | emptyList | Null if not found, otherwise the children (used for recursive call) |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<T> | Null 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 System.Windows.DependencyObject.
Declaration
public static CompositionContainer GetContainer(this DependencyObject element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | element | The element from which to read the property value. |
Returns
Type | Description |
---|---|
System.ComponentModel.Composition.Hosting.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 System.Windows.DependencyObject.
Declaration
public static void SetContainer(this DependencyObject element, CompositionContainer value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | element | The element on which to set the attached property. |
System.ComponentModel.Composition.Hosting.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. |