Ticks & Thumb questions

5 posts, 1 answers
  1. Nicolas
    Nicolas avatar
    6 posts
    Member since:
    Mar 2010

    Posted 09 Apr 2010 Link to this post

    Hello,
    First, thanks for making such a great library! I saved many hours by using the WPF controls.
    I am working with the Slider with Selection Range enabled at the moment.
    My slider should start at -12 and end at 0. This range can change, but will remain from a negative value to 0.
    I would like the tick marks to be set every 4 units for instance, but I want the slider to increase or decrease by one only. Do you have any tip on how to achieve such behavior?
    I would like also to lock the position of a thumb in a range slider, is that possible?
    Thanks in advance for your support.
  2. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 13 Apr 2010 Link to this post

    Hi Nicolas Bastin,

    RadSlider supports the functionality of having two thumbs, thus enabling range selection. To enable the selection range you have to set the IsSelectionRangeEnabled property to true. Modifying the range can be done via two additional properties - SelectionStart and SelectionEnd. However, when a selection range is enabled, there cannot be another thumb in the range.

    RadSlider's properties - LargeChange and SmallChange allow you to define the amount of value that will be used as a step-size. Setting LargeChange, for example, will control how much the thumb will travel when the track is clicked. SmallChange on the other hand is used when RadSlider has its handles visible. Clicking any of the handles will increase/decrease the value by the amount specified in SmallChange.

    The TickFrequency property allows you to place marks(ticks) along the track in a uniform manner.
    When the IsSnapToTickEnabled property is set to true and you drag the thumb, click the handles or simply click the track, then the thumb snaps to the nearest tick.

    However, if you need to display ticks on every 4 units but still have a step-size of 1, what you can use is a TickTemplateSelector.  It allows you to define your own logic controlling how the ticks can be displayed.

    public class TickTemplateSelector : DataTemplateSelector
        {
            public DataTemplate EllipseTemplate { get; set; }
            public DataTemplate EmptyTemplate { get; set; }
     
            public override DataTemplate SelectTemplate(object item, DependencyObject container)
            {
                double tick = Convert.ToDouble(item);
                if (tick % 4 == 0.0)
                {
                    return EllipseTemplate;
                }
                else
                {
                    return EmptyTemplate;
                }
            }
        }

    I have prepared an example for you, demonstrating how to use the described properties to implement the scenario you described. Please take a look at it and let me know if you need more info.

    Sincerely yours,
    Tina Stancheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Nicolas
    Nicolas avatar
    6 posts
    Member since:
    Mar 2010

    Posted 13 Apr 2010 Link to this post

    Thank you Tina! I didn't think of the template selector, but it really solves my problem!
  5. Nicolas
    Nicolas avatar
    6 posts
    Member since:
    Mar 2010

    Posted 08 Nov 2010 Link to this post

    Hello,
    How come the container parameter is null?
    I would like to access the RadSlider Maximum and Minimum to know if I should make the tick visible or not.
    If in your example I change the Tick Template from an Ellipse to a TextBox, I have some strange behaviour, can you make sure it's working for you?
    Regards
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Nov 2010 Link to this post

    Hello Nicolas Bastin,

    Thank you for your cooperation. This appears to be a bug in the RadSlider. However, we fixed it and the fix will be included in the Q3 2010 official release of the Telerik controls later this week. I updated your Telerik points accordingly.

    Please let us know if you need more info and we would be glad to assist you.

    Greetings,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready