Skip to content

This repository contains a sample on How to style the month cell using MonthCellLoaded event in the Syncfusion Xamarin.Forms Calendar (SfCalendar)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/style-month-cell-calendar-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to style the month cell using MonthCellLoaded event in Xamarin.Forms Calendar (SfCalendar)

You can style the month cell using theOnMonthCellLoaded event of SfCalendar in Xamarin.Forms.

You can also refer the following article.

https://www.syncfusion.com/kb/11863/how-to-style-the-month-cell-using-monthcellloaded-event-in-xamarin-forms-calendar

C#

By using the OnMonthCellLoaded you can customize the Text, BackgroudColor , BorderColor and Font by using the MonthCellLoadedEventArgs argument

this.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;
   var 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 the specific day 
           args.BackgroundColor = Color.Red;
          }
    }
}

Output

CustomCell

About

This repository contains a sample on How to style the month cell using MonthCellLoaded event in the Syncfusion Xamarin.Forms Calendar (SfCalendar)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages