ControlExtensions Class
Provides extension methods for the type Control and related types.
public static class ControlExtensions
- Inheritance:
- object object
Methods
FindAncestorOrSelf<T>(Control)
Starting with the control itself, searches the control hierarchy for the first ancestor of type T.
public static T FindAncestorOrSelf<T>(this Control source)
- Type Parameters:
-
T-The type of object to locate.
| Parameter | Type | Description |
|---|---|---|
| source | Control | The control where the search will begin. |
Returns
- T:
The control itself or the first ancestor of type
T; otherwise the default value ofTif no match is found.
FindAncestorOrSelf<T>(Control, Predicate<T>)
Starting with the control itself, searches the control hierarchy for the first ancestor of type T.
public static T FindAncestorOrSelf<T>(this Control source, Predicate<T> predicate)
- Type Parameters:
-
T-The type of object to locate.
| Parameter | Type | Description |
|---|---|---|
| source | Control | The control where the search will begin. |
| predicate | Predicate<T> | A predicate which must be satisfied for the ancestor to match. |
Returns
- T:
The control itself or the first ancestor of type
T; otherwise the default value ofTif no match is found.
FindAncestor<T>(Control)
Searches the control hierarchy for the first ancestor of type T.
public static T FindAncestor<T>(this Control source)
- Type Parameters:
-
T-The type of ancestor to locate.
| Parameter | Type | Description |
|---|---|---|
| source | Control | The child control. |
Returns
- T:
The first ancestor of type
T; otherwise the default value ofTif no match is found.
FindAncestor<T>(Control, Predicate<T>)
Searches the control hierarchy for the first ancestor of type T.
public static T FindAncestor<T>(this Control source, Predicate<T> predicate)
- Type Parameters:
-
T-The type of ancestor to locate.
| Parameter | Type | Description |
|---|---|---|
| source | Control | The child control. |
| predicate | Predicate<T> | A predicate which must be satisfied for the ancestor to match. |
Returns
- T:
The first ancestor of type
Twhich matches the predicate; otherwise the default value ofTif no match is found.