#1,019 – Constraining a Slider to Integer Values

The Value property of a Slider can take on any value between the Minimum and Maximum values.  Because it is of type double, it will normally take on a series of real number values as the user drags the thumb.


If you want to constrain the Slider values to be integer values only, you can set the following properties:

  • TickFrequency : 1
  • IsSnapToTickEnabled : True

Tickmarks will not be shown, but the Slider will now be constrained only to integer values.

        <Slider Name="mySlider" Margin="10"
                Minimum="1" Maximum="100"
                TickFrequency="1" IsSnapToTickEnabled="True"/>
        <StackPanel Orientation="Horizontal">
            <Label Content="Value:" VerticalAlignment="Center"/>
            <TextBlock Text="{Binding Path=Value, ElementName=mySlider}"



About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

2 Responses to #1,019 – Constraining a Slider to Integer Values

  1. Pingback: Dew Drop – February 28, 2014 (#1733) | Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: