Disable slider keyboard events
.net, c#, wpf
Solution
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" />
Problem
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?