This is a migrated thread and some comments may be shown as answers.

SelectedDataRange to null

1 Answer 23 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Maurizio
Top achievements
Rank 1
Maurizio asked on 04 Mar 2017, 03:29 AM

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

1 Answer, 1 is accepted

Sort by
0
Maurizio
Top achievements
Rank 1
answered on 04 Mar 2017, 03:44 AM

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

...

Tags
Calendar
Asked by
Maurizio
Top achievements
Rank 1
Answers by
Maurizio
Top achievements
Rank 1
Share this question
or