protected override void OnPreviewKeyDown(KeyEventArgs e) { base.OnPreviewKeyDown(e); if (e.Key == Key.Enter || e.Key == Key.Tab) { if (CommandOnKeyEnter != null) { var cmdParameter = new CommandParameterOnKeyDown(); cmdParameter.CommandParameter = CommandParameterOnKeyEnter; cmdParameter.Key = e.Key; if (CommandOnKeyEnter.CanExecute(cmdParameter)) { CommandOnKeyEnter.Execute(cmdParameter); if (cmdParameter.Handled) { return; } } } if (NextControlOnKeyTabEnter != null) { NextControlOnKeyTabEnter.Focus(); e.Handled = true; } } }
protected override void OnSelectionChanged(SelectionChangedEventArgs e) { base.OnSelectionChanged(e); if (NextControlOnKeyTabEnter != null) { NextControlOnKeyTabEnter.Focus(); } }
protected override void OnCalendarClosed(RoutedEventArgs e) { base.OnCalendarClosed(e); if (NextControlOnKeyTabEnter != null) { NextControlOnKeyTabEnter.Focus(); } }
protected override void OnPreviewKeyDown(KeyEventArgs e) { base.OnPreviewKeyDown(e); if (e.Key == Key.Enter || (CommandOnKeyEnterIncludesTab && e.Key == Key.Tab)) { if (CommandOnKeyEnter != null) { e.Handled = true; var cmdParameter = new CommandParameterOnKeyDown(); cmdParameter.CommandParameter = CommandParameterOnKeyEnter; cmdParameter.Key = e.Key; if (CommandOnKeyEnter.CanExecute(cmdParameter)) { CommandOnKeyEnter.Execute(cmdParameter); if (cmdParameter.Handled) { return; } } } if (NextControlOnKeyTabEnter != null) { NextControlOnKeyTabEnter.Focus(); e.Handled = true; } } else if (InputType == TextBoxExInputType.OnlyCharacters) { if (e.Key == Key.Space) { e.Handled = true; return; } } }