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

Reset selected dates in Calendar

          Please help me to resolve the issue. In my scenario i want to show the previous selected dates.if user tap on any date .Previous dates are need to deselect or Reset . How to reset the selected dates in xamarin forms sfCalendar. 

3 Replies

RK Rathana Kumar Sekar Syncfusion Team April 27, 2017 10:24 AM UTC

Hi Mukesh,

Thanks for contacting Syncfusion Support.

We have checked the reported requirement from our side and we need more detail to provide appropriate solution on this. So, could you please provide below mentioned information.

1)Current SelectionMode(Single Selection or Multi Selection)
2)Your exact requirement in detail.

Rathanakumar S.

MU mukesh April 27, 2017 11:24 AM UTC

Hi Rathana Kumar,

        1.I am using Multi Selection mode.

        2. Requirement :   
                                    I am developing a Travelling category mobile app using xamarin forms. In my scenario i want  to select multiple dates in one tap. So i am using SF calendar with multi selection mode. 
Here is my code

_calendarView = new SfCalendar();

                        _calendarView.SelectionMode = SelectionMode.MultiSelection;
			_calendarView.NavigationButtonWidth = 10;
			_calendarView.NavigationArrowThickness = 8;
			_calendarView.ShowNavigationButtons = true;
			_calendarView.ToggleDaySelection = true;
			_calendarView.NavigateToMonthOnInActiveDatesSelection = true;

			DateTime mindate = DateTime.Now.Date;
			_calendarView.MinDate = mindate;
			MonthLabelSettings labelSettings = new MonthLabelSettings();
			labelSettings.DateFormat = "dd";
			labelSettings.DayLabelSize = 20;
			labelSettings.DayFormat = "EEE";
			labelSettings.DateLabelSize = 12;
			MonthViewSettings monthViewSettings = new MonthViewSettings();
			monthViewSettings.TodayTextColor = App.AppColor;
			monthViewSettings.InlineBackgroundColor = App.AppColor;
			monthViewSettings.SelectedDayTextColor = Color.White;
			monthViewSettings.DateSelectionColor = App.AppColor;
			monthViewSettings.HeaderBackgroundColor = App.AppColor;
			monthViewSettings.HeaderTextColor = Color.White;
			monthViewSettings.DayHeaderTextColor = Color.White;
			monthViewSettings.DayHeaderBackgroundColor = Color.FromHex("FF8B00");
			monthViewSettings.MonthLabelSettings = labelSettings;
			_calendarView.MonthViewSettings = monthViewSettings;

So i can able to select multiple dates. On Tap on Entry (or) Text box I am using popup to show the calendar so user select Start date and End Date popup will close and selected dates will appear in text box.
If user want to change the previous selected start date and End date. I am using below code for previous selecting dates by default.

List<DateTime> allDates = new List<DateTime>();

Here i am adding the dates which are previously selected.

if (previousStartdate != default(DateTime))
				for (DateTime date = previousStartdate; date <= previousEnddate; date = date.AddDays(1))
In (all days) list  i am getting complete list of selected dates.so i am assigning those dates to my calander control

foreach (var item in allDates)
I can able to see the previous selected dates. If user select any new date i want to remove all previous selected dates.

I am using _calendarView.SelectionChanged += _calendarView_SelectionChanged; event to know the user selected the new date.

void _calendarView_SelectionChanged(object sender, SelectionChangedEventArgs args)

The clear event is not work forking for me.When i clear the _calendarView.SelectedDates. I able to see in backend the dates are clear but Calendar UI is not updated . Here i want to reset the previous selected dates and select the new date.


One more issue is In android _calendarView.SelectionChanged += _calendarView_SelectionChanged; automatically hitting the event without selecting the new date.And the method is hitting multiple times 6 to 7 times. In IOS it is working properly .I am using shared code so same logic will work for both but in android i am facing this _calendarView.SelectionChanged auto firing issue.
I am very new syncfusin control so please help me on this .

Thanks & Regards,


RK Rathana Kumar Sekar Syncfusion Team May 1, 2017 08:27 AM UTC

Hi Mukesh,

Thanks for your update.

Query 1: Issue with SelectedDates Clear method

We could reproduce the reported issue from our side. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates.

Query 2: SelectionChanged event fire multiple times in Android.

We were unable to reproduce the reported issue from our side and we have attached the sample which we have tested the reported issue. Please find the sample from the below link.

So could you please provide more information like modified sample which replicates the reported issue.

It will help us to provide appropriate solution on this.

Rathanakumar S.

Live Chat Icon For mobile
Up arrow icon