In a WPF application, I have a control that I have derived from TextBox like this:
public class SelectableTextBlock : TextBox { protected override void O
The PreviewKeyDown event exists exactly for this sort of thing.
private void spacebarHandler_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Space) e.Handled = true; }
Your KeyDown handler will never receive the KeyDown event for spacebar.