Home  separator  Controls  separator  Slider
Bookmark and Share Share...    Subscribe to this feed Feed   About Christian Moser  


WPF Slider Control

How to Make a Slider Snap to Integer Values

If you just set the Minimum and Maximum of a slider and choose a value the result is determined by the pixel position of the thumb. The value is typically a high-precision value with many decimal places. To allow only integer values you have to set the IsSnapToTickEnabled property to True.

<Slider Minimum="0"
        Maximum="20"
        IsSnapToTickEnabled="True"
        TickFrequency="2"
 




Last modified: 2009-08-05 13:39:36
Copyright (c) by Christian Moser, 2011.

 Comments on this article

Show all comments
Rick Hard...
Commented on 11.August 2009
This simply will not compile in eclipse. Waste of time.
Mark
Commented on 12.August 2009
Rick, you could try using common sense and adding the missing '>' yourself, don't you think?
Nick
Commented on 13.August 2009
Ahem.. '/>' actually.. ;)
Nithin
Commented on 27.August 2009
Why u people kidding a good guy...
Mick
Commented on 17.November 2009
isn't this just a snippet anyways... This broke my cobol
David
Commented on 22.December 2009
rofl
su
Commented on 5.January 2010
Here, this should work:

<Slider Minimum="0" Maximum="20" IsSnapToTickEnabled="True" TickFrequency="2"> </Slider>
Rushin
Commented on 1.February 2010
Dont u criticize people idiotic mark
Navneet
Commented on 1.February 2010
Dont u criticize people idiotic mark
nash
Commented on 10.March 2010
what r u doin man, this is rubbish
karthik
Commented on 26.March 2010
Hai,if anybody can send me the tutorial of wpf for beginners
Nithin
Commented on 6.May 2010
sure, go here: http://www.wpftutorial.net
Daniel
Commented on 11.August 2010
Im not agree with criticize people, but Im agree with Mark, this missing /> its a very simple error. If you read the previus topics of this tutorial you should correct it by yourself.
abab
Commented on 4.November 2010
lets fuck letss fuckkkkkk
chut
Commented on 4.November 2010
sab indian chutiye
bbbbbbbbbbbb...
Commented on 2.December 2010
lol
Suhasis
Commented on 8.December 2010
Good comments from Educated people
Happy
Commented on 16.December 2010
good site
Aarti Varadkar
Commented on 21.December 2010
Not satisfied with this example.
Check out this link for WPF Slider control:http://nayyeri.net/slider-control-in-windows-presentation-foundation
Martin
Commented on 20.March 2011
If a developer needs to get each information in detail it is better to keep your hands of.
Thanks Christian to spend your time for us...
Developer
Commented on 21.March 2011
I think these are very minor errors, and they are not by his fault, this is because of that HTML Box on which Overflow property is hidden. Try to concentrate on what he is going to teach you. Also, if you are so perfect then buy a domain and make a website like him but with no errors in the code. But you dont know anything so you are just making fun by these stupid things.
Kaushal
Commented on 15.April 2011
Please give the brief description about the SLIDER.
Rick
Commented on 8.June 2011
Doesn't work in IE8.
Waseem
Commented on 18.August 2011
can u give more details about slider.. i searched it on the internet but does not found a good example

Name
E-Mail (optional)
Comment