SfCalendar - Disable selection

Hello,

I wonder if there is a way to disable selection in SfCalendar (Xamarin Forms) other than adding all possible dates to the BlackoutDates?


Kind regards,

Valeriy


5 Replies

SS SaiGanesh Sakthivel Syncfusion Team January 20, 2022 12:02 PM UTC

Hi Valeriy, 
 
#Regarding disable the date selection in SfCalendar. 
Your requirement can be achieved with the help of OnCalendarTapped event. Inside the event, you can call the ClearSelection method to disable the date selection in the view. Please refer to the following code snippet for your reference. 
 
Code Snippet 
private void Calendar_OnCalendarTapped(object sender, CalendarTappedEventArgs e) 
{ 
    calendar.ClearSelection(); 
} 
 
Please refer to the sample in the following locations. 
 
Please let us know if you have any concerns. 
 
Regards,
SaiGanesh Sakthivel
 



VK Valeriy Kovalenko January 20, 2022 04:28 PM UTC

Thank you! Works great!


Kind regards,

Valeriy



SS SaiGanesh Sakthivel Syncfusion Team January 21, 2022 02:02 PM UTC

Hi Valeriy, 
 
We are glad to know that the given solution helped to achieve your requirement. Please let us know if you need any further assistance.  
 
Regards,
SaiGanesh Sakthivel
 



VK Valeriy Kovalenko January 22, 2022 11:07 AM UTC

Hi SaiGanesh,

Our QA found that it's still possible to select a day by doing a long tap. Is there a workaround for this?


Kind regards,

Valeriy



SS SaiGanesh Sakthivel Syncfusion Team January 24, 2022 12:38 PM UTC

Hi Valeriy, 
 
#Regarding disable the date selection in SfCalendar. 
Your requirement can be achieved with the help of SelectionChanged event. Inside the event, you can call the ClearSelection method to disable the date selection in the view. Please refer to the following code snippet for your reference. 
 
Code Snippet 
private void Calendar_SelectionChanged(object sender, Syncfusion.SfCalendar.XForms.SelectionChangedEventArgs e) 
{ 
    calendar.ClearSelection(); 
} 
 
Please let us know if you have any concerns. 
 
Regards,
SaiGanesh Sakthivel
 


Loader.
Up arrow icon