You can customize the default behavior of the Xuni Calendar control to select specific dates. For instance, consider a scenario where you wish to select only weekdays on tapping two dates in different workweeks. For this, you simply need to subscribe the OnSelectionChanging event and apply selection condition in the handler.
The following image shows a Xuni Calendar that only selects weekdays and deselects weekends on tapping two different dates in different workweeks.
XAML |
Copy Code |
---|---|
<Grid> <xuni:XuniCalendar SelectionChanging="OnSelectionChanging" MaxSelectionCount="-1"/> </Grid> |
C# |
Copy Code |
---|---|
private void OnSelectionChanging(object sender, CalendarSelectionChangingEventArgs e) { foreach (var date in e.SelectedDates.ToArray()) { if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday) e.SelectedDates.Remove(date); } } |