For a project I’m working on, I needed a way to select a date range. One of my first thoughts was to use a double slider only to find that one didn’t exist with the OOTB controls so I decided to roll my own. In order to solidify things in my mind as well as help anyone out there looking for resources on various aspects of development in WPF, I thought I’d write about my experience creating this control.
I’ll be adding blog entries in the next week or two to describe how I accomplished implemenation of some of the features I wanted in my control:
- Create a two-thumbed slider control to choose a DateTime range. (Part 1)
- Don’t let the the lower slider or upper slider pass each other. I was creating this to use with a graph and if the sliders passed each other even for a millisecond, the graph would throw an exception. (Part 2)
- Dependency Properties (Part 3)
I did lose some of the functionality of the regular slider in my first version of this control, such as clicking to the right or left of the thumb to change the value and displaying the slider in a vertical format, but overall, I’m happy with this control as it is so far (and so was my client.)
Because I wanted to continue work on this control and make it easy to download and use the code, the source for the control and a sample project are available at CodePlex.