Bug: RadSlider does not receive focus when the slider track is clicked

2 posts, 1 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 11 Apr 2013 Link to this post

    We rely on the focus event of several of the Telerik controls to provide help texts for our users. When a control is focused, a short help text is displayed in a TextBlock in another area of the page. RadSlider does fire the focus event when the slider thumb is used, but not when the track part of the slider is clicked. I managed to solve the problem by inheriting from RadSlider and overriding OnApplyTemplate. I then hook up to the Click events of the LargeIncreaseButton and LargeDecreaseButton elements. When either of them are clicked I just focus the slider control manually. See the code below. But it would be nice if we did not have to do this. It seems logical to me that the control should focus when the track is clicked.

    public class CustomSlider : RadSlider
    {
        private RepeatButton _LargeDecrease;
        private RepeatButton _LargeIncrease;
     
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
     
            if (_LargeDecrease == null || _LargeIncrease == null)
            {
                _LargeDecrease = base.GetTemplateChild("LargeDecreaseButton") as RepeatButton;
                _LargeIncrease = base.GetTemplateChild("LargeIncreaseButton") as RepeatButton;
            }
            else
            {
                _LargeDecrease.Click -= _LargeDecrease_Click;
                _LargeIncrease.Click -= _LargeIncrease_Click;
            }
     
            if (_LargeDecrease != null)
            {
                _LargeDecrease.Click += _LargeDecrease_Click;
            }
     
            if (_LargeIncrease != null)
            {
                _LargeIncrease.Click += _LargeIncrease_Click;
            }
        }
     
        private void _LargeIncrease_Click(object sender, RoutedEventArgs e)
        {
            this.Focus();
        }
     
        private void _LargeDecrease_Click(object sender, RoutedEventArgs e)
        {
            this.Focus();
        }
    }
  2. Answer
    Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 15 Apr 2013 Link to this post

    Hello Henrik,

    It seems that we have a bug in our RadSlider control. Clicking on the LargeIncrease/Decrease buttons does not focus the slider properly.

    We will include the fix in our next internal build scheduled for April, 22. In the meantime I updated your Telerik points as a small sign of our gratitude for bringing this case to out attention.

    Kind regards,
    Kiril Vandov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top