Hello.
I just wanted to report an issue that I encountered today when I updated my nuget packet to the new build.
I have an application that I've had developed for quite a while that used the DateTimePicker as part of search criteria in an MVVM light viewmodel. It worked fine until I updated the package.
I downloaded and referenced the 2.8 libraries and things worked again. So, i'm unsure if something changed that perhaps I am violating, or there may be an issue.
For reference, in my viewmodel I have a property defined as below:
```
private DateTime? _createdAfter = null;
public DateTime? CreatedAfter
{
get
{
if (IsInDesignMode) { return new DateTime(2012, 12, 12); }
else { return _createdAfter; }
}
set
{
if (_createdAfter != value)
{
_createdAfter = value;
RaisePropertyChanged(() => CreatedAfter);
}
}
}
```
Bound to the DateTimePicker as thus:
```
<xctk:DateTimePicker Format="Custom" Value="{Binding CreatedAfter, Mode=TwoWay}" />
```
After updating I got the following error:
__Index was out of range. Must be non-negative and less than the size of the collection.__
with this stack trace error:
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at Xceed.Wpf.Toolkit.DateTimeUpDown.OnValueChanged(Nullable`1 oldValue, Nullable`1 newValue)
at Xceed.Wpf.Toolkit.DateTimePicker.OnValueChanged(Nullable`1 oldValue, Nullable`1 newValue)
at Xceed.Wpf.Toolkit.Primitives.UpDownBase`1.OnValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
at System.Windows.DependencyObject.ClearValue(DependencyProperty dp)
Comments: ** Comment from web user: BoucherS **
I just wanted to report an issue that I encountered today when I updated my nuget packet to the new build.
I have an application that I've had developed for quite a while that used the DateTimePicker as part of search criteria in an MVVM light viewmodel. It worked fine until I updated the package.
I downloaded and referenced the 2.8 libraries and things worked again. So, i'm unsure if something changed that perhaps I am violating, or there may be an issue.
For reference, in my viewmodel I have a property defined as below:
```
private DateTime? _createdAfter = null;
public DateTime? CreatedAfter
{
get
{
if (IsInDesignMode) { return new DateTime(2012, 12, 12); }
else { return _createdAfter; }
}
set
{
if (_createdAfter != value)
{
_createdAfter = value;
RaisePropertyChanged(() => CreatedAfter);
}
}
}
```
Bound to the DateTimePicker as thus:
```
<xctk:DateTimePicker Format="Custom" Value="{Binding CreatedAfter, Mode=TwoWay}" />
```
After updating I got the following error:
__Index was out of range. Must be non-negative and less than the size of the collection.__
with this stack trace error:
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at Xceed.Wpf.Toolkit.DateTimeUpDown.OnValueChanged(Nullable`1 oldValue, Nullable`1 newValue)
at Xceed.Wpf.Toolkit.DateTimePicker.OnValueChanged(Nullable`1 oldValue, Nullable`1 newValue)
at Xceed.Wpf.Toolkit.Primitives.UpDownBase`1.OnValueChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
at System.Windows.DependencyObject.ClearValue(DependencyProperty dp)
Comments: ** Comment from web user: BoucherS **
Hi,
Thanks for your feedback.
Make sure that when you use the DateTimePicker.Format property to "Custom", you also set a value for property DateTimePicker.FormatString.