WinRT Edition Basic Library > Input for WinRT > Input for WinRT Task-Based Help > C1NumericBox Task-Based Help > Setting the Minimum and Maximum Values |
You can use the C1NumericBox.Minimum and C1NumericBox.Maximum properties to set a numeric range that users are limited to at run time. If the C1NumericBox.Minimum and C1NumericBox.Maximum properties are set, users will not be able to pick a number larger than the C1NumericBox.Minimum or smaller than the C1NumericBox.Maximum.
When setting the C1NumericBox.Minimum and C1NumericBox.Maximum properties, the C1NumericBox.Minimum should be smaller than the C1NumericBox.Maximum. Also be sure to set the C1NumericBox.Value property to a number within the C1NumericBox.Minimum and C1NumericBox.Maximum range. In the following example, the default value 0 falls within the range chosen. |
At Design Time
To set the C1NumericBox.Minimum and C1NumericBox.Maximum, complete the following steps:
This will set C1NumericBox.Minimum and C1NumericBox.Maximum values.
In XAML
To set the C1NumericBox.Minimum and C1NumericBox.Maximum in XAML addMaximum="500" Minimum="-500" to the <Xaml:C1NumericBox> tag so that it appears similar to the following:
Markup |
Copy Code
|
---|---|
<Xaml:C1NumericBox x:Name="C1NumericBox1" Maximum="500" Minimum="-500"></Xaml:C1NumericBox> |
In Code
To set the C1NumericBox.Minimum and C1NumericBox.Maximum add the following code to your project:
Visual Basic |
Copy Code
|
---|---|
C1NumericBox1.Minimum = -500 C1NumericBox1.Maximum = 500 |
C# |
Copy Code
|
---|---|
c1NumericBox1.Minimum = -500; c1NumericBox1.Maximum = 500; |
Run your project and observe:
Users will be limited to the selected range at run time.