Samuele Dassatti
Samuele Dassatti

Reputation: 269

Automatically select a date in an UWP CalendarView

In my UWP app, I want the current day to be automatically selected on a CalendarView, but I can't change the value of the SelectedDates property.

Upvotes: 0

Views: 302

Answers (1)

Vijay Nirmal
Vijay Nirmal

Reputation: 5837

Since SelectedDates is List you can't directly assign a new value to SelectedDates. If you use SelectionMode="Single" then Clear the list and use Add.

MyCalendarView.SelectedDates.Clear();
MyCalendarView.SelectedDates.Add(DateTimeOffset.Now);

Upvotes: 2

Related Questions