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();
}
}