Setting the Minimum and Maximum Values

You can use the Minimum and Maximum properties to set a numeric range that users are limited to at run time. If the Minimum and Maximum properties are set, users will not be able to pick a number larger than the Minimum or smaller than the Maximum.

Note: When setting the Minimum and Maximum properties, the Minimum should be smaller than the Maximum. Also be sure to set the Value property to a number within the Minimum and Maximum range. In the following example, the default value 0 falls within the range chosen.

At Design Time

To set the Minimum and Maximum in Blend or Visual Studio, complete the following steps:

1.   Click the C1NumericBox control once to select it.

2.   Navigate to the Properties tab, and enter a number, for example 500, next to the Maximum property.

3.   In the Properties tab, enter a number, for example -500, next to the Minimum property.

This will set Minimum and Maximum values.

In XAML

To set the Minimum and Maximum in XAML add Maximum="500" Minimum="-500" to the <c1:C1NumericBox> tag so that it appears similar to the following:

<c1:C1NumericBox x:Name="C1NumericBox1" Maximum="500" Minimum="-500"></c1:C1NumericBox>

In Code

To set the Minimum and Maximum add the following code to your project:

      Visual Basic

      C#

Run your project and observe:

Users will be limited to the selected range at run time.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.