We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

RangeSelection and SelectedDates on ios

Hello

I am using a SfCalendar with RangeSelection. I am using calendar.SelectedDates.Count in my code, this works fine on android and I get the amount, but when I try the exact same thing on ios it always is 0, not null but 0. It's probably a bug, can you let me know if it is? I suspect that there are simply no selected dates.

Regards
Jens De Rijcke

4 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team August 29, 2019 10:41 AM UTC

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-selecteddates

Although 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; 
        } 
 
We have attached the sample for your reference,

Sample link: CalendarRangeSelection_Sample 

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   



JD jens de rijcke August 30, 2019 06:54 AM UTC

Hello

I solved it with the e.DateAdded. It's just weird that it behaves different while it is multiplatform. So that makes that it is unusable in my application.
Anyway, thanks.

Regards
Jens De Rijcke


SP Subburaj Pandian Veluchamy Syncfusion Team August 30, 2019 10:08 AM UTC

Hi Jens De Rijcke,  
   
Thank you for the update. We are glad that the given solution meets your requirement. 

As we mentioned, we will update this behavior as common in all platforms in our upcoming releases.  
 
Please let us know, if you would require any further assistance. We will happy to assist you. 
  
Regards,
Subburaj Pandian V  



IR Indumathi Ravichandran Syncfusion Team October 4, 2019 12:50 PM UTC

Hi Jens, 
 
We are glad to announce that our Essential Studio 2019 Volume 3 Release version 17.3.0.14 is rolled out with the requested behavior change “SelecedDates property gives the value for RangeSelection in Android” and is available for download under the following link. 
  
 
Nuget link: 
 
Release notes link: 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards,     
Indumathi R 


Loader.
Live Chat Icon For mobile
Up arrow icon