Class NumericUpDown
Represents an up-down control (also known as spin box) that displays numeric values.
[ControlCategory("Common")]
public class NumericUpDown : IntPicker, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, ILayoutItem, 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.
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.
- NumericUpDown(Control)
Initializes a new instance of the NumericUpDown class.