Open ali-h2010 opened 6 years ago
Hi Ali,
For disable deselection, you may set SpecialDate property "Selectable = false".
I don't know how to remove borders.
Hi Brighthui, Thanks for your reply. Can you Kindly demonstrate how to do this in Xamal or the Code behind? I only have specialDates property which takes a list.
Sorry for the noob question @Brighthui this is all what I tried: XamForms.Controls.SpecialDate test = new XamForms.Controls.SpecialDate(DateTime.Today); test.Selectable = false;
It's not working though
I added the above special date, but I can still deselect dates calendar.SpecialDates.Add(test);
This only made today's date unelectable
I was able to remove the deselection by commenting the condition that checks if the date is selected in the file Calendar.Selected.cs
//if (button.IsSelected) //{ // ResetButton(button); //} //else //{ SelectedDates.Add(SelectedDate.Value.Date); var spD = SpecialDates?.FirstOrDefault(s => s.Date.Date == button.Date.Value.Date); SetButtonSelected(button, spD); //}
But now, how can I create the package or use the updated code on my project? any help will be appreciated.
I am not sure what i did differently but the solution above is not working. I lost the source for the code that i modified to remove deselection. I only have the nuget package. Can someone help please
I added this code `if (!date.HasValue) return false;
if (SelectedDates.Count()>0)//check if there is a selected date
{
int result = DateTime.Compare((System.DateTime)date, SelectedDates[0]);
if (result == 0)//Equal Dates
{
return false;
}
}`
in the Calendar.Selected.cs
and commented the line in DateClickedEvent in calendar.cs as the following:
protected void DateClickedEvent(object s, EventArgs a) { var selectedDate = (s as CalendarButton).Date; if (SelectedDate.HasValue && selectedDate.HasValue && SelectedDate.Value == selectedDate.Value) { ChangeSelectedDate(selectedDate); //removed to avoid deselection //SelectedDate = null; } else { SelectedDate = selectedDate; } }
First of all, I would like to thank every person who contributed to create and maintain this great component.
I have 2 questions
Is this possible without changing the source code? any help will be appreciated.