We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Different Color for every day

Thread ID:

Created:

Updated:

Platform:

Replies:

141786 Jan 4,2019 06:10 AM UTC Jan 21,2019 08:46 AM UTC Xamarin.Forms 5
loading
Tags: SfCalendar
argie
Asked On January 4, 2019 06:10 AM UTC

Hi is there a way to change the background color of a day, like in January 1 i want it to be background with red, then in January 6 I want to it blue.
Thank you

Subburaj Pandian Veluchamy [Syncfusion]
Replied On January 7, 2019 09:19 AM UTC

Hi Argie. 
 
Thank you for contacting Syncfusion support. 
 
Based on the provided information, we have checked and your requirement of “Setting different background color to the each day in month of Calendar” in Xamarin.Forms can be achieved using OnMonthCellLoaded event of Calendar. Using this event, you can get the specific date details and can set the style (BackgroundColor, BorderColor, etc..). Please refer the following code example for the same, 
 
[c#] 
            calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded; 
 
private void Calendar_OnMonthCellLoaded(object sender, MonthCellLoadedEventArgs e) 
        { 
            if (e.Date == new DateTime(2019, 1, 1)) 
            { 
                e.BackgroundColor = Color.Red; 
            } 
            else if (e.Date == new DateTime(2019, 1, 6)) 
            { 
                e.BackgroundColor = Color.Blue; 
            } 
        } 
 
 
You can also refer our user guide documentation regarding the same by the following link, 
 
 
Please let us know, if this helpful. 
 
Regards,
Subburaj Pandian V 


argie
Replied On January 9, 2019 06:21 AM UTC

Thank you very much sir/ma'am Subburaj.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On January 9, 2019 10:38 AM UTC

Hi Argie,  
  
Thank you for the update. Please let us know, if you need any further assistance. 
 
Regards,
Subburaj Pandian V  


Faisal Saidali KV
Replied On January 19, 2019 06:56 PM UTC

Hi Subburaj Pandian Veluchamy,
How can I change the colour of text/cell of a particular day in YearView mode?


Subburaj Pandian Veluchamy [Syncfusion]
Replied On January 21, 2019 08:46 AM UTC

Hi Faisal, 
 
As of now, we don’t have support to customize the dates of month in the Calendar Year view mode in Xamarin.Forms. Although, you can customize the entire cell for month by passing the required view to the View argument of OnYearCellLoaded event in calendar. Please refer the following code example for the same, 
 
[c#] 
calendar.OnYearCellLoaded += Calendar_OnYearCellLoaded; 
 
        } 
        private void Calendar_OnYearCellLoaded(object sender, YearCellLoadedEventArgs e) 
        { 
            e.View = customView; 
        } 
 
 
 
Please let us know, if you have any concern. 
 
Regards,
Subburaj Pandian V  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;