Class NumericUpDown
Represents a control that enables single value selection from a numeric range of values through a Spinner and TextBox.
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
[TemplatePart(Name = "Text", Type = typeof(TextBox))]
[TemplatePart(Name = "Spinner", Type = typeof(Spinner))]
[StyleTypedProperty(Property = "SpinnerStyle", StyleTargetType = typeof(ButtonSpinner))]
public class NumericUpDown : UpDownBase<double>
Constructors
| Improve this Doc View SourceNumericUpDown()
Initializes a new instance of the NumericUpDown class.
Declaration
public NumericUpDown()
Fields
| Improve this Doc View SourceDecimalPlacesProperty
Identifies the DecimalPlaces dependency property.
Declaration
public static readonly DependencyProperty DecimalPlacesProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IncrementProperty
Identifies the Increment dependency property.
Declaration
public static readonly DependencyProperty IncrementProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
MaximumProperty
Identifies the Maximum dependency property.
Declaration
public static readonly DependencyProperty MaximumProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
MinimumProperty
Identifies the Minimum dependency property.
Declaration
public static readonly DependencyProperty MinimumProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceDecimalPlaces
Gets or sets the number of decimal places that are displayed in the NumericUpDown.
Declaration
public int DecimalPlaces { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
The default value is zero.
DecimalPlaces decides output format of Value property. It is implemented via formatString field and FormatValue override.
Increment
Gets or sets a value added or subtracted from the value property.
Declaration
public double Increment { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
The default values is one.
Maximum
Gets or sets the Maximum possible Value.
Declaration
public double Maximum { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
The default values is one.
Minimum
Gets or sets the Minimum possible Value.
Declaration
public double Minimum { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
The default value is zero.
Methods
| Improve this Doc View SourceFormatValue()
Provides decimal specific value formatting for the value property.
Declaration
protected override string FormatValue()
Returns
Type | Description |
---|---|
System.String | Formatted Value. |
Overrides
OnApplyTemplate()
Builds the visual tree for the NumericUpDown control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
OnCreateAutomationPeer()
Returns a NumericUpDownAutomationPeer for use by the Silverlight automation infrastructure.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer | A NumericUpDownAutomationPeer object for the NumericUpDown. |
Overrides
| Improve this Doc View SourceOnDecimalPlacesChanged(Int32, Int32)
Called when the DecimalPlaces property value has changed.
Declaration
protected virtual void OnDecimalPlacesChanged(int oldValue, int newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | oldValue | Old value of the DecimalPlaces property. |
System.Int32 | newValue | New value of the DecimalPlaces property. |
OnDecrement()
Called by OnSpin when the spin direction is SpinDirection.Decrease.
Declaration
protected override void OnDecrement()
Overrides
OnIncrement()
Called by OnSpin when the spin direction is SpinDirection.Increase.
Declaration
protected override void OnIncrement()
Overrides
OnIncrementChanged(Double, Double)
Called when the Increment property value has changed.
Declaration
protected virtual void OnIncrementChanged(double oldValue, double newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | oldValue | Old value of the Increment property. |
System.Double | newValue | New value of the Increment property. |
OnMaximumChanged(Double, Double)
Called when the Maximum property value has changed.
Declaration
protected virtual void OnMaximumChanged(double oldValue, double newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | oldValue | Old value of the Maximum property. |
System.Double | newValue | New value of the Maximum property. |
OnMinimumChanged(Double, Double)
Called when the Minimum property value has changed.
Declaration
protected virtual void OnMinimumChanged(double oldValue, double newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | oldValue | Old value of the Minimum property. |
System.Double | newValue | New value of the Minimum property. |
OnValueChanged(RoutedPropertyChangedEventArgs<Double>)
Override UpDownBase<T>.OnValueChanged to raise value changed automation event and determine if a maximum or minimum has been reached.
Declaration
protected override void OnValueChanged(RoutedPropertyChangedEventArgs<double> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangedEventArgs<System.Double> | e | Event args. |
Overrides
OnValueChanging(RoutedPropertyChangingEventArgs<Double>)
Override UpDownBase<T>.OnValueChanging to do validation and coercion.
Declaration
protected override void OnValueChanging(RoutedPropertyChangingEventArgs<double> e)
Parameters
Type | Name | Description |
---|---|---|
RoutedPropertyChangingEventArgs<System.Double> | e | Event args. |
Overrides
ParseValue(String)
Called by ApplyValue to parse user input as a decimal number.
Declaration
protected override double ParseValue(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | User input. |
Returns
Type | Description |
---|---|
System.Double | Value parsed from user input. |