This is a migrated thread and some comments may be shown as answers.
Bug: RadSlider does not receive focus when the slider track is clicked
1 Answer 10 Views
This is a migrated thread and some comments may be shown as answers.
hwsoderlund
Top achievements
Rank 1
hwsoderlund asked on 11 Apr 2013, 12:44 PM
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();
    }
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Kiril Vandov
Telerik team
answered on 15 Apr 2013, 05:03 PM
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.

Asked by
hwsoderlund
Top achievements
Rank 1
Answers by
Kiril Vandov
Telerik team
Share this question
or