Class UpDownBase<T>
Base class for all controls that provide value manipulation with a Spinner and a text box.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.Input.Toolkit.dll
Syntax
[TemplatePart(Name = "Text", Type = typeof(TextBox))]
[TemplatePart(Name = "Spinner", Type = typeof(Spinner))]
[StyleTypedProperty(Property = "SpinnerStyle", StyleTargetType = typeof(Spinner))]
public abstract class UpDownBase<T> : UpDownBase, IControl, IFrameworkElement, IUIElement, IDependencyObject
Type Parameters
| Name | Description |
|---|---|
| T | Type of Value property. |
Constructors
| Improve this Doc View SourceUpDownBase()
Initializes a new instance of the UpDownBase(of T) class.
Declaration
protected UpDownBase()
Fields
| Improve this Doc View SourceIsEditableProperty
Identifies the IsEditable dependency property.
Declaration
public static readonly DependencyProperty IsEditableProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
ValueProperty
Identifies the Value dependency property.
Declaration
public static readonly DependencyProperty ValueProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
| Improve this Doc View SourceIsEditable
Gets or sets a value indicating whether the value can be manually edited by the end-user.
Declaration
public bool IsEditable { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Value
Gets or sets the Value property.
Declaration
public virtual T Value { get; set; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
| Improve this Doc View SourceApplyValue(String)
Processes user input when the TextBox.TextChanged event occurs.
Declaration
protected virtual void ApplyValue(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | User input. |
FormatValue()
Renders the value property into the textbox text.
Declaration
protected abstract string FormatValue()
Returns
| Type | Description |
|---|---|
| System.String | Formatted Value. |
GetValue()
GetValue override to return Value property as object type.
Declaration
public sealed override object GetValue()
Returns
| Type | Description |
|---|---|
| System.Object | The Value property as object type. |
Overrides
| Improve this Doc View SourceOnApplyTemplate()
Builds the visual tree for the UpDownBase(of T) control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnDecrement()
Called by OnSpin when the spin direction is SpinDirection.Increase.
Declaration
protected abstract void OnDecrement()
OnIncrement()
Called by OnSpin when the spin direction is SpinDirection.Increase.
Declaration
protected abstract void OnIncrement()
OnIsEditableChanged(Boolean, Boolean)
Called when IsEditable property value changed.
Declaration
protected virtual void OnIsEditableChanged(bool oldValue, bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | oldValue | The old value. |
| System.Boolean | newValue | The new value. |
OnKeyDown(KeyEventArgs)
Provides handling for the KeyDown event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyEventArgs | e | Key event args. |
Overrides
Remarks
Only support up and down arrow keys.
OnMouseWheel(MouseWheelEventArgs)
Provides handling for the MouseWheel event.
Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| MouseWheelEventArgs | e | Mouse wheel event args. |
Overrides
| Improve this Doc View SourceOnParseError(UpDownParseErrorEventArgs)
Raises the ParserError event when there is an error in parsing user input.
Declaration
protected virtual void OnParseError(UpDownParseErrorEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| UpDownParseErrorEventArgs | e | Event args. |
OnParsing(UpDownParsingEventArgs<T>)
Raises the Parsing event, to allow easily hooking into the parse logic.
Declaration
protected virtual void OnParsing(UpDownParsingEventArgs<T> e)
Parameters
| Type | Name | Description |
|---|---|---|
| UpDownParsingEventArgs<T> | e | The UpDownParsingEventArgs<T> instance containing the event data. |
OnSpin(SpinEventArgs)
Occurs when the spinner spins.
Declaration
protected virtual void OnSpin(SpinEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| SpinEventArgs | e | Event args. |
OnValueChanged(RoutedPropertyChangedEventArgs<T>)
Raises the ValueChanged event when Value property has changed.
Declaration
protected virtual void OnValueChanged(RoutedPropertyChangedEventArgs<T> e)
Parameters
| Type | Name | Description |
|---|---|---|
| RoutedPropertyChangedEventArgs<T> | e | Event args. |
OnValueChanging(RoutedPropertyChangingEventArgs<T>)
Raises the ValueChanging event when Value property is changing.
Declaration
protected virtual void OnValueChanging(RoutedPropertyChangingEventArgs<T> e)
Parameters
| Type | Name | Description |
|---|---|---|
| RoutedPropertyChangingEventArgs<T> | e | Event args. |
ParseValue(String)
Called by ApplyValue to parse user input.
Declaration
protected abstract T ParseValue(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | User input. |
Returns
| Type | Description |
|---|---|
| T | Value parsed from user input. |
SelectAllText()
Selects all text.
Declaration
protected virtual void SelectAllText()
SetValue(Object)
SetValue override to set value to Value property.
Declaration
public sealed override void SetValue(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | value | New value. |
Overrides
Events
| Improve this Doc View SourceParseError
Occurs when there is an error in parsing user input and allows adding parsing logic.
Declaration
public event EventHandler<UpDownParseErrorEventArgs> ParseError
Event Type
| Type | Description |
|---|---|
| System.EventHandler<UpDownParseErrorEventArgs> |
Parsing
Occurs when a value is being parsed and allows custom parsing.
Declaration
public event EventHandler<UpDownParsingEventArgs<T>> Parsing
Event Type
| Type | Description |
|---|---|
| System.EventHandler<UpDownParsingEventArgs<T>> |
ValueChanged
Occurs when Value property has changed.
Declaration
public event RoutedPropertyChangedEventHandler<T> ValueChanged
Event Type
| Type | Description |
|---|---|
| RoutedPropertyChangedEventHandler<T> |
ValueChanging
Occurs when Value property is changing.
Declaration
public event RoutedPropertyChangingEventHandler<T> ValueChanging
Event Type
| Type | Description |
|---|---|
| RoutedPropertyChangingEventHandler<T> |