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. Image for the cookie policy date
close icon

Different Color for every day

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

5 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team 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 



AR argie January 9, 2019 06:21 AM UTC

Thank you very much sir/ma'am Subburaj.


SP Subburaj Pandian Veluchamy Syncfusion Team 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  



FS Faisal Saidali KV 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?



SP Subburaj Pandian Veluchamy Syncfusion Team 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  
 


Loader.
Live Chat Icon For mobile
Up arrow icon