#1,025 – Small and Large Changes to the Value of a Slider

When you use the mouse to drag the thumb of a Slider control, you can set the value of the slider to any value within its range.  (This is true unless you’ve set the IsSnapToTickEnabled property to true, in which case you’re constrained to values at tickmarks).

You can also increase or decrease the value of the Slider by:

  • Using the arrow keys on the keyboard – changes value by SmallChange property amount – default 0.1
  • Left-clicking in the Slider on one side of the thumb or the other – changes value by LargeChange property amount – default 1.0

You can change these default values by setting the SmallChange and/or LargeChange properties.

For example:

<Slider Name="mySlider" Margin="10"
        Minimum="0" Maximum="50"
        SmallChange="1" LargeChange="5"/>

With these changes, you can now use the arrow keys to change the Slider’s value by 1.0 and can left-click next to the thumb to change the value by 5.0.

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a comment