I have this slider in my XAML:
<Slider Width="250"
Margin="0,-2,0,0"
VerticalAlignment="Center"
Name="TimeSlider"
Maximum="100"
Thumb.DragStarted="MouseEnterSlider"
Thumb.DragCompleted="MouseLeaveSlider"
ValueChanged="TimeSlider_ValueChanged" />
I noticed the if I press the up/down arrow keys on the keyboard, the slider will change its value.
I tried to disable it with:
TimeSlider.IsEnabled = false;
But this disables the slider completely. Is there a way to only disable the up/down arrow keys?
Set Focusable to false, like so:
<Slider Width="250" Margin="0,-2,0,0" VerticalAlignment="Center" Name="TimeSlider" Maximum="100" Thumb.DragStarted="MouseEnterSlider" Thumb.DragCompleted="MouseLeaveSlider" ValueChanged="TimeSlider_ValueChanged" Focusable="False" />
Try using the PreviewKeyDown event on the Control you want to use, and handle it the way you want to handle, and set e.Handled to True, so it won't get to the slider.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With