Home Forums WPF controls Xceed Toolkit Plus for WPF MultiCalendar – Set null value to SelectedDate

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • guillaumeIrec
    Participant
    Post count: 1
    #44665 |

    Hi,

    I try to set null value to the SelectedDate property of the MultiCalendar component but when I do it, I receive an exception: Nullable object must have a value.
    So I take a look on the source code (Blueprint subscription) and I see on the OnSelectedDateChanged event of the MultiCalendar class, that you cast the Nullable<DateTime> newValue to DateTime without checking if the newValue is null:

    protected virtual void OnSelectedDateChanged( Nullable<DateTime> oldValue, Nullable<DateTime> newValue )
    {
      if( !_isChangingInternal )
      {
        if( this.SelectedDates.Count > 0 )
        {
          this.SelectedDates.Clear();
        }
        _rangeStartDate = (DateTime)newValue;
      }
      ...
    

    Can you provide a fix for this bug?

    Regards

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi,

    This issue should be fixed in our upcoming service release V3.4.

    For now, simply add a check:
    if( newValue != null )
    {
    _rangeStartDate = (DateTime)newValue;
    }

    Diane [Xceed]
    Moderator
    Post count: 1353

    This is to inform you that the following issue was fixed in the latest version (Toolkit for WPF v3.4):
    “In MultiCalendar, setting the SelectedDate to null will no longer cause a crash.”

    Download Link: http://forums.xceed.com/latest-xceed-toolkit-plus-for-wpf

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.