Class NumericUpDown<T>
Enables the user to increase or decrease a value with the mouse or keyboard in type-safe way.
public class NumericUpDown<T> : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IValue<T>, IValue where T : notnull
Type Parameters
T
- Inheritance
-
NumericUpDown<T>
- Implements
-
IValue<T>
- Derived
- Inherited Members
- Extension Methods
Remarks
Supports the following types: int, long, double, double , decimal. Attempting to use any other type will result in an InvalidOperationException.
Default key bindings are inherited from DefaultKeyBindings:
| Key | Action |
|---|---|
| CursorUp | Increases the value (Up). |
| CursorDown | Decreases the value (Down). |
View-specific bindings can be added via DefaultKeyBindings.
Constructors
- NumericUpDown()
Initializes a new instance of the NumericUpDown<T> class.
Properties
- DefaultKeyBindings
Gets or sets the view-specific default key bindings for NumericUpDown<T>. All standard navigation bindings are inherited from DefaultKeyBindings, so this dictionary is empty by default.
IMPORTANT: This is a process-wide static property. Change with care. Do not set in parallelizable unit tests.
- Format
Gets or sets the format string used to display the value. The default is "{0}".
- Value
Gets or sets the value that will be incremented or decremented.
Methods
- OnDrawingText()
Called when the Text of the View is to be drawn.
- OnValueChanged(ValueChangedEventArgs<T?>)
Called after Value has changed.
- OnValueChanging(ValueChangingEventArgs<T?>)
Called before Value changes. Return true to cancel the change.
- TryConvert<TValue>(object, out TValue?)
Attempts to convert the specified
valueto typeTValue.
Events
- FormatChanged
Raised when Format has changed.
- IncrementChanged
Raised when Increment has changed.
- ValueChanged
Raised when Value has changed.
- ValueChangedUntyped
Raised when Value has changed, providing the value as an un-typed object.
- ValueChanging
Raised when Value is about to change. Set Handled to true to cancel the change.