How to disable cell tap in SFCalendar control?

Syncfusion Team,

I am using the SFCalendar control to display user's absences with dates highlighted on it. But I want to disable the tap event of cell (dates) in this control.

Would you please help me how to to this?

Currently I have disabled the whole control so that user can not tap on any date but can just view it. But this also disables the swipe left or right behaviour of calendar control. 

I appreciate your help in this.

Thanks,

Milan Gohil


3 Replies

SS SaiGanesh Sakthivel Syncfusion Team March 22, 2022 01:21 PM UTC

Hi Milan, 
 
#Regarding How to disable the OnCalendarTapped the dates in SfCalendar 
Your requirement can be achieved with the help of BlackoutDates property in SfCalendar. Add the dates in the collection which could be disable the interaction in the view. Please refer to the following code snippet for your reference. 
 
Code Snippet 
List<DateTime> black_Dates = new List<DateTime>(); 
black_Dates.Add(new DateTime(2022, 03, 18)); 
black_Dates.Add(new DateTime(2022, 03, 19)); 
black_Dates.Add(new DateTime(2022, 03, 20)); 
black_Dates.Add(new DateTime(2022, 03, 21)); 
black_Dates.Add(new DateTime(2022, 03, 22)); 
black_Dates.Add(new DateTime(2022, 03, 23)); 
black_Dates.Add(new DateTime(2022, 03, 24)); 
black_Dates.Add(new DateTime(2022, 03, 25)); 
black_Dates.Add(new DateTime(2022, 03, 26)); 
black_Dates.Add(new DateTime(2022, 03, 27)); 
calendar.BlackoutDates = black_Dates; 
 
Please refer to the tested sample in the following location. 
 
Please let us know if you have any concerns. 
 
Regards,
SaiGanesh Sakthivel



MG Milan Gohil March 28, 2022 09:11 AM UTC

Syncfusion Team,

Thank you for your reply.

I am programatically selecting the Dates and DateRanges so that they get highlighted with round coloured circle in the calendar. If you use this solution (BlackoutDates), it will completely override my programatically selected dates.

As per below screenshot, I want to keep my selection as it is without loosing it, and want to disable tap on each dates of calendar, so user can not change this selection.



Thanks,

Milan Gohil



SS SaiGanesh Sakthivel Syncfusion Team March 29, 2022 11:53 AM UTC

Hi Milan,


As per the implementation of SfCalendar, if you tap on the selected date range again, the date selection should be reselected. This is the expected behavior. As of now, we do not have support for restricting the tap interaction to the selected date range.


Regards,
SaiGanesh Sakthivel


Loader.
Up arrow icon