public static void HandlePreviewKeyDown(this IKeyHandler keyHandler, object sender, System.Windows.Input.KeyEventArgs e) { //bool fFocusedControlIsTextBox = FocusManager.GetFocusedElement(this).GetType().Equals(typeof(TextBox)); var fFocusedControlIsTextBox = Keyboard.FocusedElement != null && Keyboard.FocusedElement.GetType() == typeof(TextBox); if (fFocusedControlIsTextBox) { e.Handled = false; } else if (keyHandler != null) { var handled = keyHandler.HandleKeyDown(e.Key); e.Handled = handled; } }
protected override void OnKeyDown(KeyEventArgs e) { _keyHandler.HandleKeyDown(e, e.Modifiers); }
private void MainForm_KeyDown(object sender, KeyEventArgs e) { _keyHandler.HandleKeyDown(e, ModifierKeys); }