SelectedDataRange to null

2 posts, 0 answers
  1. Maurizio
    Maurizio avatar
    4 posts
    Member since:
    Jan 2014

    Posted 03 Mar Link to this post

    Hi,

    thanks for having shared the UWP controls with the community.

    I'm trying to use the Calendar and I've bound its SelectedRangeDate to a DateTime SelectedDate in my viewmodel using the converter you provided and TwoWay mode.

    It works ok when selecting the date from the control but I can't unselect the cell by putting in my VM SelectedDate to null (I'm using MvvmLight and its ViewModelBase for my VM, thus calling Set(ref m_SelectedDate, value) and so automagically raising the PropertyChanged event).

    What I would like to achieve is having again an empty calendar, meaning with no selected cells.

    What am I doing wrong?

    thank you

  2. Maurizio
    Maurizio avatar
    4 posts
    Member since:
    Jan 2014

    Posted 03 Mar in reply to Maurizio Link to this post

    Can it be related to line 193 of SelectionService.cs? I think it throws an exception saying "Nullable object must have a value."

    handler(this.Owner, new CurrentSelectionChangedEventArgs() { NewSelection = this.Owner.SelectedDateRange.Value

    ...

Back to Top