private void NewGroupTextBox_OnKeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key != VirtualKey.Enter)
            {
                return;
            }
            var textBox = sender as TextBoxWithButton;

            ActionButtonCommand.Execute(textBox?.Text);
            // Stop the event from triggering twice
            e.Handled = true;
        }
Ejemplo n.º 2
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            var button = GetTemplateChild("PART_ACTION_BUTTON") as Button;

            if (button != null)
            {
                button.Click += (sender, args) =>
                {
                    ActionButtonClick?.Invoke(this, args);
                    ActionButtonCommand?.Execute(this);
                };
            }
        }