Table of Contents

Class NumericUpDown

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Represents an up-down control (also known as spin box) that displays numeric values.

[ControlCategory("Common")]
public class NumericUpDown : Control, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
Inheritance
NumericUpDown
Implements

Examples

Here is how to declare a NumericUpDown in UIXML:

<NumericUpDown Name="numericUpDown" Margin="8" Minimum="50" Maximum="200" Value="125" ValueChanged="NumericUpDown_ValueChanged" />

And the corresponding event handler in the code-behind:

private void NumericUpDown_ValueChanged(object sender, EventArgs e)
{
    string text = numericUpDown.Value.ToString();
    MessageBox.Show(text, string.Empty);
}

Also, a NumericUpDown can be created from code:

var progressBarControlNumericUpDown = new Alternet.UI.NumericUpDown() { Maximum = 10, Margin = new Thickness(0, 0, 0, 5) };
var progressBar = new Alternet.UI.ProgressBar() { Maximum = 10, Margin = new Thickness(0, 0, 0, 5) };

progressBarControlNumericUpDown.ValueChanged += (o, e) => progressBar.Value = (int)progressBarControlNumericUpDown.Value;
progressBarControlNumericUpDown.Value = 1;

Remarks

A NumericUpDown control contains a single numeric value that can be incremented or decremented by clicking the up or down buttons of the control. To specify the allowable range of values for the control, set the Minimum and Maximum properties.

Examples of how a NumericUpDown can look on different platforms:

Set Value property to specify the value assigned to the spin box. A NumericUpDown, like any other Control, can be disabled by setting its Enabled property to false.

Constructors

NumericUpDown()

Initializes a new instance of the NumericUpDown class.

Properties

ControlKind

Returns control identifier.

Handler

Gets control handler.

Maximum

Gets or sets the maximum allowed value for the numeric up-down control.

Minimum

Gets or sets the minimum allowed value for the numeric up-down control.

Value

Gets or sets the value assigned to the spin box (also known as an up-down control).

Methods

CreateHandler()

Creates a handler for the control.

IncrementValue(int)

Increments or decrements value.

OnMaximumChanged(EventArgs)

Called when the maximum of the Maximum property changes.

OnMinimumChanged(EventArgs)

Called when the minimum of the Minimum property changes.

OnValueChanged(EventArgs)

Called when the value of the Value property changes.

RaiseValueChanged(EventArgs)

Raises the ValueChanged event and calls OnValueChanged(EventArgs).

Events

MaximumChanged

Occurs when the value of the Maximum property changes.

MinimumChanged

Occurs when the value of the Minimum property changes.

ValueChanged

Occurs when the Value property has been changed in some way.