Ejemplo n.º 1
0
        private void ActiveDatePicker(DatePicker datePicker)
        {
            var txt = VisualTreeUtils.FindChild <TextBox>(datePicker, "PART_TextBox");

            Keyboard.Focus(txt);
            txt.Select(0, 2);
        }
Ejemplo n.º 2
0
        private void ActiveComboBox(ComboBox combo)
        {
            var txt = VisualTreeUtils.FindChild <TextBox>(combo, "PART_EditableTextBox");

            Keyboard.Focus(txt);
            txt.SelectAll();
            combo.IsDropDownOpen = true;
        }
Ejemplo n.º 3
0
        private static void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var foreignKeyPicker = sender as ForeignKeyPicker;

            if (foreignKeyPicker.IsPopupOpen == true)
            {
                var p = (e.OriginalSource as FrameworkElement).Parent as DataGridCell;
                if (p != null)
                {
                    var foreignKeyPickerChild = VisualTreeUtils.FindChild <ForeignKeyPicker>(foreignKeyPicker.PopupView);
                    if (foreignKeyPickerChild == null || foreignKeyPickerChild.IsPopupOpen == false)
                    {
                        foreignKeyPicker.ClosePopup();
                    }
                    //not set Handled because need this event to update SelectedIndex
                }
            }
        }
Ejemplo n.º 4
0
        private static void OnPreviewKeyDown(object sender, KeyEventArgs e)
        {
            var foreignKeyPicker = sender as ForeignKeyPicker;

            if (e.Key == Key.Enter)
            {
                if (foreignKeyPicker.IsPopupOpen == true)
                {
                    var p = e.OriginalSource as DataGridCell;
                    if (p != null)
                    {
                        var foreignKeyPickerChild = VisualTreeUtils.FindChild <ForeignKeyPicker>(foreignKeyPicker.PopupView);
                        if (foreignKeyPickerChild == null || foreignKeyPickerChild.IsPopupOpen == false)
                        {
                            foreignKeyPicker.ClosePopup();
                            e.Handled = true;//set Handled for not move to next row
                        }
                    }
                }
            }
        }