Articles in this section
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:

 

Screenshot_20180301-143003.png

 

 

 

iOS:

 

../Desktop/Simulator%20Screen%20Shot%2001-Mar-2018%20at%202.38.02%20PM.png

UWP:

 

C:\Users\suganya.sethuraman\AppData\Local\Microsoft\Windows\INetCache\Content.Word\wp_ss_20180301_0001.png

 

Please download the custom sample to customize the current and other months’ date cell from below location  

 

Location :

 

https://www.syncfusion.com/downloads/support/directtrac/general/ze/GettingStartedKBSyncfusion619540485.zip

 

 

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied