/// <returns> /// <c>true</c> to prevent the default editor action for the given key, or <c>false</c> to allow it. /// </returns> private bool TextAreaOnDoProcessDialogKey(Keys data) { if ((Singleline || ReadOnly) && data == Keys.Enter) { _multilineHelper.SubmitForm(); return(false); } return(ShouldPreventTabKey(data)); }
private void OnPreviewKeyDown(object sender, KeyEventArgs e) { var control = e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control); var shift = e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Shift); if (e.Handled) { return; } if (_completionController.IgnoreTabOrEnterKey) { return; } if (Singleline && e.Key == Key.Enter) { e.Handled = true; } if ((Singleline || ReadOnly) && e.Key == Key.Enter) { _multilineHelper.SubmitForm(); return; } if ((Singleline || ReadOnly) && e.Key == Key.Tab) { e.Handled = true; _elementHost.SelectNextControl(!shift); } if (ReadOnly && control && (e.Key == Key.Z || e.Key == Key.Y)) { e.Handled = true; } }