Category / Section
How to Identify the current month day cell in SfCalendar?
1 min read
Syncfusion’s SfCalendar control has been revamped with three-layer view for improving the performance. With this architecture changes at the same time three view of calendar has been loaded. By maintain IsCurrentMonth Property in OnMonthCellLoaded's arguments, we able to find the current month and possible to customize.
You can define the calendar control using below code,
Using XAML/XML:
<?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:Syncfusion ="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms" x:Class="GettingStartedKBSyncfusion.MainPage"> <ContentPage.Content> <Syncfusion:SfCalendar x:Name="sfCalendar" OnMonthCellLoaded="Handle_OnMonthCellLoaded" /> </ContentPage.Content> </ContentPage>
OnMonthCellLoaded event definition:
void Handle_OnMonthCellLoaded(object sender, Syncfusion.SfCalendar.XForms.MonthCell args) { if (args.IsCurrentMonth) { args.TextColor = Color.FromHex("#F9F3F2"); args.BackgroundColor = Color.FromHex("#581845"); } else { args.TextColor = Color.FromHex("#ADD9F5"); args.BackgroundColor = Color.FromHex("#212F3D"); } }
Screenshots:
Android:
iOS:
UWP:
Please download the custom sample to customize the current and other months’ date cell from below location
Location :