Hi Jens,
Thank you for contacting Syncfusion support.
We have checked your query “
SelectedDates property of calendar not returning correct count” in Xamarin.Forms.iOS.
SelectedDates property is only for the
MultiSelection SelectionMode in Calendar, not for the
RangeSelection. We have mentioned the same in our User Guide documentation as well,
UG link:
https://help.syncfusion.com/xamarin/sfcalendar/calendar-mvvm#binding-selecteddatesAlthough we have considered this behavior difference “SelectedDates property gives value for RangeSelection in Android” as a defect and internally logged the defect report for the same. We will update this behavior as common (all platforms) in our upcoming releases.
Your requirement of “Getting Selected Range dates and it’s count in calendar” can be achieved in two ways. Using SelectedRange property of Calendar, you can get the Start and End of the Selected Range and DateAdded property of SelectionChangedEventArgs in the SelectionChanged event of Calendar, you can get the selected dates collection within the range. Please refer the following code snippet,
[C#]
calendar.SelectionChanged += Calendar_SelectionChanged;
…
private void Calendar_SelectionChanged(object sender, Syncfusion.SfCalendar.XForms.SelectionChangedEventArgs e)
{
// You can get the SelectedRange Start date and End date
var selectedRange = calendar.SelectedRange;
// Using this can get the selected date collection within the range
var selectedDateCollection = e.DateAdded;
// Get the selected dates count
var selectedDatesCount = e.DateAdded.Count;
} |
In SelectionChangedEventArgs of the SelectionChanged event, you can get the DateAdded, DateRemoved and NewRangeAdded values.
We hope this helps. Please let us know, if you would require any further assistance.
Regards,
Subburaj Pandian V