DependencyPropertyChangedEventArgsExtensions Class
Provides extension methods for the type System.Windows.DependencyPropertyChangedEventArgs
public static class DependencyPropertyChangedEventArgsExtensions
- Inheritance:
- object object
Methods
GetNewValue<T>(DependencyPropertyChangedEventArgs?)
Returns a typed value from System.Windows.DependencyPropertyChangedEventArgs.NewValue.
public static T? GetNewValue<T>(this DependencyPropertyChangedEventArgs? e)
- Type Parameters:
-
T-The value type.
| Parameter | Type | Description |
|---|---|---|
| e | DependencyPropertyChangedEventArgs | The event data. |
Returns
- T
Remarks
When System.Windows.DependencyPropertyChangedEventArgs.NewValue is null, value types will return their corresponding default value.
An InvalidCastException will be thrown if a non-null value cannot be cast to the value type T.
Exceptions
| Type | Condition |
|---|---|
| InvalidCastException |
GetOldAndNewValue<T>(DependencyPropertyChangedEventArgs?)
Returns a typed value from System.Windows.DependencyPropertyChangedEventArgs.OldValue and System.Windows.DependencyPropertyChangedEventArgs.NewValue.
public static (T? oldValue, T? newValue) GetOldAndNewValue<T>(this DependencyPropertyChangedEventArgs? e)
- Type Parameters:
-
T-The value type.
| Parameter | Type | Description |
|---|---|---|
| e | DependencyPropertyChangedEventArgs | The event data. |
Returns
Remarks
When System.Windows.DependencyPropertyChangedEventArgs.OldValue or System.Windows.DependencyPropertyChangedEventArgs.NewValue are null, value types will return their corresponding default value.
An InvalidCastException will be thrown if a non-null value cannot be cast to the value type T.
Exceptions
| Type | Condition |
|---|---|
| InvalidCastException |
GetOldValue<T>(DependencyPropertyChangedEventArgs?)
Returns a typed value from System.Windows.DependencyPropertyChangedEventArgs.OldValue.
public static T? GetOldValue<T>(this DependencyPropertyChangedEventArgs? e)
- Type Parameters:
-
T-The value type.
| Parameter | Type | Description |
|---|---|---|
| e | DependencyPropertyChangedEventArgs | The event data. |
Returns
- T
Remarks
When System.Windows.DependencyPropertyChangedEventArgs.OldValue is null, value types will return their corresponding default value.
An InvalidCastException will be thrown if a non-null value cannot be cast to the value type T.
Exceptions
| Type | Condition |
|---|---|
| InvalidCastException |