Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            if (NextControlOnKeyTabEnter != null)
            {
                NextControlOnKeyTabEnter.Focus();
            }
        }
Ejemplo n.º 3
0
        protected override void OnCalendarClosed(RoutedEventArgs e)
        {
            base.OnCalendarClosed(e);

            if (NextControlOnKeyTabEnter != null)
            {
                NextControlOnKeyTabEnter.Focus();
            }
        }
Ejemplo n.º 4
0
        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;
                }
            }
        }