Step Interval in WPF Double TextBox

18 Feb 20253 minutes to read

The DoubleTextBox control allows you to increase or decrease the value by pressing up-arrow and down-arrow keys in keyboard or mouse wheel over the control. The ScrollInterval property is used to specify the increment or decrement interval. The default value of ScrollInterval is 1.

For example, the ScrollInterval value is set to 4. So, that the DoubleTextBox control Value increases or decreases by 4 while pressing Up arrow or Down arrow keys and Mouse wheel scrolling up or down.

Change Value on Up, Down arrow key

The DoubleTextBox control allows you to increase or decrease the Value of DoubleTextBox based on the ScrollInterval by pressing the up arrow and down arrow keys on the keyboard.

<syncfusion:DoubleTextBox x:Name="doubleTextBox" Width="150"
                          Height="25" Value ="10" ScrollInterval="2"/>
DoubleTextBox doubleTextBox = new DoubleTextBox();
doubleTextBox.Width = 150;
doubleTextBox.Height = 25;
doubleTextBox.Value = 10;
doubleTextBox.ScrollInterval = 2;

Changing Value by Up and Down Arrow Key in WPF DoubleTextBox

Change Value on Mouse Wheel

The DoubleTextBox allows you to increase or decrease the Value based on the ScrollInterval by the Mouse scrolling over the control When the IsScrollingOnCircle property is true. The default value of IsScrollingOnCircle property is true.

<syncfusion:DoubleTextBox x:Name="doubleTextBox" Width="150" Height="25" Value ="34" 
                          IsScrollingOnCircle="True" ScrollInterval="3"/>
DoubleTextBox doubleTextBox = new DoubleTextBox();
doubleTextBox.Width = 150;
doubleTextBox.Height = 25;
doubleTextBox.Value = 34;
doubleTextBox.IsScrollingOnCircle = true;
doubleTextBox.ScrollInterval = 3;

Changing Value by Mouse Wheel in WPF DoubleTextBox

Change Value on Click and Drag

The DoubleTextBox allows you to increase or decrease the value based on the ScrollInterval by clicking and dragging the mouse when the EnableExtendedScrolling property is true. DoubleTextBox value increases when you click and drag the mouse to the right or the top of the screen and decreases when the mouse moves to the left or the bottom of the screen. Before that, the control should be in an unfocused state.

<syncfusion:DoubleTextBox x:Name="doubleTextBox" Width="120" Height="25" Value ="10" 
                          ScrollInterval="5" EnableExtendedScrolling="True"/>
DoubleTextBox doubleTextBox = new DoubleTextBox();
doubleTextBox.Width = 120;
doubleTextBox.Height = 25;
doubleTextBox.Value = 10;
doubleTextBox.ScrollInterval = 5;
doubleTextBox.EnableExtendedScrolling = true;

Changing Value by Clicking and Drag in WPF DoubleTextBox

Allow or restrict selection on focus

DoubleTextBox allows you to automatically select text by setting TextSelectionOnFocus property to true and when the control got focus. If you want to restrict the selection on when control got focus, use the TextSelectionOnFocus property value as false. The default value of the TextSelectionOnFocus property is true.

<syncfusion:DoubleTextBox x:Name="doubleTextBox" TextSelectionOnFocus="False"/>
DoubleTextBox doubleTextBox = new DoubleTextBox();
doubleTextBox.TextSelectionOnFocus = true;

TextSelectionOnFocus = “False”

Restrict Text Selection in WPF DoubleTextBox

TextSelectionOnFocus = “True”

WPF DoubleTextBox displays Text Selection