Exemplo n.º 1
0
        void OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            e.Handled = true;

            if (ComboBoxHelper.ShouldFilterUnnecessaryComboBoxEvent(sender as ComboBox))
            {
                return;
            }

            CommitChanges();
        }
Exemplo n.º 2
0
        void OnBoxLoaded(object sender, RoutedEventArgs e)
        {
            UIElement box      = (UIElement)sender;
            ComboBox  comboBox = box as ComboBox;

            if (comboBox != null)
            {
                if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
                {
                    if (!string.IsNullOrEmpty(ComboBoxAutomationName))
                    {
                        comboBox.SetValue(AutomationProperties.NameProperty, ComboBoxAutomationName);
                    }
                    if (comboBox.IsEditable && comboBox.Template != null)
                    {
                        var comboBoxTextBox = comboBox.Template.FindName("PART_EditableTextBox", comboBox) as TextBox;
                        if (comboBoxTextBox != null && !string.IsNullOrEmpty(EditorAutomationName))
                        {
                            comboBoxTextBox.SetValue(AutomationProperties.NameProperty, EditorAutomationName);
                        }
                    }
                }

                if (comboBox.IsVisible)
                {
                    ComboBoxHelper.SynchronizeComboBoxSelection(comboBox, this.ViewModel.Text);
                }
            }

            if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
            {
                TextBox textBox = box as TextBox;
                if (textBox != null && !string.IsNullOrEmpty(EditorAutomationName))
                {
                    textBox.SetValue(AutomationProperties.NameProperty, EditorAutomationName);
                }
            }

            if (box.IsVisible)
            {
                box.Focus();
            }
            Control control = sender as Control;

            if (control != null && control.Visibility == Visibility.Visible)
            {
                this.visibleBox = control;
                EnableKeyboardLostFocus();
            }

            this.ViewModel.SaveOldText();
        }
Exemplo n.º 3
0
        void OnBoxLoaded(object sender, RoutedEventArgs e)
        {
            UIElement box      = (UIElement)sender;
            ComboBox  comboBox = box as ComboBox;

            if (comboBox != null && comboBox.IsVisible)
            {
                ComboBoxHelper.SynchronizeComboBoxSelection(comboBox, this.ViewModel.Text);
            }
            if (box.IsVisible)
            {
                box.Focus();
            }
            Control control = sender as Control;

            if (control != null && control.Visibility == Visibility.Visible)
            {
                this.visibleBox = control;
                EnableKeyboardLostFocus();
            }

            this.ViewModel.SaveOldText();
        }