WPF and Silverlight Edition Basic Library / NumericBox / NumericBox Elements / Setting Values
Setting Values

There are four properties to set to control the currently selected number (Value), how much that number changes when the Up or Down button is clicked at run-time (Increment), and the range of numbers that can be selected (Minimum and Maximum).

The Value property determines the currently selected number. By default the C1NumericBox control starts with its Value set to 0 but you can customize this number at design time, in XAML, and in code.

In XAML

To set the Value property add Value="123" to the <c1:C1NumericBox> tag so that it appears similar to the following:

XAML
Copy Code
<c1:C1NumericBox Name="C1NumericBox1" Value="123" />

In Code

To set the Value property add the following code to your project:

Visual Basic
Copy Code
C1NumericBox1.Value = 123

 

C#
Copy Code
c1NumericBox1.Value = 123;

At Design Time

To set the Value property at run time, complete the following steps:

  1. Click the C1NumericBox control once to select it.
  2. Navigate to the Properties window, and enter a number, for example "123", in the text box next to the Value property.

This will set the Value property to the number you chose.