Hello,
A System.InvalidOperationException can occurs in a DateTimePicker and a DateTimeUpDown control if the Format is set to « Custom ». Actually, the two controls cause the same error because DateTimePicker inherits from DateTimeUpDown for the Format property.
How to reproduce :
Message: System.InvalidOperationException: La séquence ne contient aucun élément.
à System.Linq.Enumerable.Last[TSource](IEnumerable
à Xceed.Wpf.Toolkit.Core.Primitives.DateTimeUpDownBase
à Xceed.Wpf.Toolkit.DateTimePicker.OnPreviewKeyDown(KeyEventArgs e)
à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
à System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
à System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
à System.Windows.Input.InputManager.ProcessStagingArea()
à System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
à System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
à System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
à System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
à System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
A System.InvalidOperationException can occurs in a DateTimePicker and a DateTimeUpDown control if the Format is set to « Custom ». Actually, the two controls cause the same error because DateTimePicker inherits from DateTimeUpDown for the Format property.
How to reproduce :
- Implements a DateTimePicker (or DateTimeUpDown) with a Custom Format.
- In the UI, enter one of the following character as the first character (dot, comma, colon, semi-colon, slash … among others)
-
A System.InvalidOperationException: Sequence contains no elements will occurs.
Message: System.InvalidOperationException: La séquence ne contient aucun élément.
à System.Linq.Enumerable.Last[TSource](IEnumerable
1 source)
à Xceed.Wpf.Toolkit.Core.Primitives.DateTimeUpDownBase
1.GetPreviousDateTimeInfo(Int32 previousSelectionStart)à Xceed.Wpf.Toolkit.Core.Primitives.DateTimeUpDownBase
1.PerformKeyboardSelection(Int32 nextSelectionStart)
à Xceed.Wpf.Toolkit.Core.Primitives.DateTimeUpDownBase
1.OnPreviewKeyDown(KeyEventArgs e)à Xceed.Wpf.Toolkit.DateTimePicker.OnPreviewKeyDown(KeyEventArgs e)
à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
à System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
à System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
à System.Windows.Input.InputManager.ProcessStagingArea()
à System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
à System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
à System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
à System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
à System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)