From 1a5060c4cfc00b001cc15b2b6d0e9dab6590cf86 Mon Sep 17 00:00:00 2001 From: brianlagunas_cp Date: Mon, 29 Aug 2011 13:51:58 +0000 Subject: [PATCH] DateTimePicker: if the Calendar is open and has focus the Up/Down keys would not navigate the calendar as expected. This has been fixed. --- .../DateTimePicker/Implementation/DateTimePicker.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimePicker/Implementation/DateTimePicker.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimePicker/Implementation/DateTimePicker.cs index fed08ddb..45ad950a 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimePicker/Implementation/DateTimePicker.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/DateTimePicker/Implementation/DateTimePicker.cs @@ -83,8 +83,8 @@ namespace Microsoft.Windows.Controls protected override void OnPreviewMouseUp(MouseButtonEventArgs e) { - if (Mouse.Captured is CalendarItem) - Mouse.Capture(null); + if (Mouse.Captured is CalendarItem) + Mouse.Capture(null); } protected override void OnValueChanged(DateTime? oldValue, DateTime? newValue) @@ -98,6 +98,13 @@ namespace Microsoft.Windows.Controls base.OnValueChanged(oldValue, newValue); } + protected override void OnPreviewKeyDown(KeyEventArgs e) + { + //if the calendar is open then we don't want to modify the behavior of navigating the calendar control with the Up/Down keys. + if (!IsOpen) + base.OnPreviewKeyDown(e); + } + #endregion //Base Class Overrides #region Event Handlers