Hi Guy,
Thank you for contacting Syncfusion support.
Based on the provided information, your requirement of “Customizing the Month cell background color based on the appointment availability on the specific day” in Calendar Xamarin.Forms can be achieved using OnMonthCellLoaded event. Using this event, you can customize Text, Backgroud, Border color and Font by using MonthCellLoadedEventArgs argument.
Please refer the following code for your reference,
[C#] calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
…
private void Calendar_OnMonthCellLoaded(object sender, MonthCellLoadedEventArgs args)
{
// As default setting Month cell Background color as Green
args.BackgroundColor = Color.Green;
appointments = calendar.DataSource as CalendarEventCollection;
for (int i = 0; i < appointments.Count; i++)
{
var appointment = appointments[i];
if (args.Date.Date == appointment.StartTime.Date)
{
// Setting Background color when the appointment available on specific day
args.BackgroundColor = Color.Red;
}
}
} |
We have prepared sample based on your requirement,
In the sample, we have set month cell Background color as Red for the appointment available days and set Green for the no events days.
Regards,
Subburaj Pandian V