private void OnKeyDown(object sender, KeyEventArgs e) { if (!IsOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { IsOpen = true; // Calendar will get focus in Calendar_Loaded(). e.Handled = true; } } else { if (_calendar.IsKeyboardFocusWithin) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { CloseDateTimePicker(true); e.Handled = true; } else { this.ManageEnterEscapeKeys(e); } } else if (_timePicker.IsKeyboardFocusWithin && !_timePicker.IsOpen && !e.Handled) { this.ManageEnterEscapeKeys(e); } } }
/// <summary> /// Handles the <see cref="E:KeyDown" /> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="KeyEventArgs" /> instance containing the event data.</param> private void OnKeyDown(object sender, KeyEventArgs e) { if (!IsOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { IsOpen = true; // Focus will be on ListBoxItem in Popup_Opened(). e.Handled = true; } } else { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { CloseColorPicker(true); e.Handled = true; } else if (e.Key == Key.Escape) { CloseColorPicker(true); e.Handled = true; } } }
private void OnKeyDown(object sender, KeyEventArgs e) { if (!IsOpen) { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { IsOpen = true; // TimeListBox_Loaded() will focus on ListBoxItem. e.Handled = true; } } else { if (KeyboardUtilities.IsKeyModifyingPopupState(e)) { CloseTimePicker(true); e.Handled = true; } else if (e.Key == Key.Enter) { CloseTimePicker(true); e.Handled = true; } else if (e.Key == Key.Escape) { Value = _initialValue; CloseTimePicker(true); e.Handled = true; } } }