alternetsoft / AlternetUI

MIT License
22 stars 2 forks source link

Stop controls from stealing focus when I use they keyboard arrow keys? #111

Closed Shadowblitz16 closed 6 months ago

Shadowblitz16 commented 6 months ago

Is there a way to disable focus loss when using the arrow keys?

generalloki commented 6 months ago

Implement KeyDown event handler in the control on which you don't want default behavior

        private void AddItemButton_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.Key == Key.Up || e.Key == Key.Down) && supressUpDown)
                e.Handled = true;
        }