Articles in this section
Category / Section

How to customize background and foreground of SfCalendar?

1 min read

By default, SfCalendar comes with a dark background and white foreground. SfCalendar allows you to customize Background,FontForeground and BorderBrushes with different colors.

For modifying complete background:

Set the calendar’s Background property to get the complete Background color.


 <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Input:SfCalendar Height="300" Width="500" Background="PaleGreen">


The following screenshot shows SfCalendar with modified Background



For Modifying CalendarDayButton’s Foreground and Background:

You can modify the calendar DayButton by changing the CellTemplate and modifying its Grid’s Background and TextBlock foreground. BorderBrush property in SfCalendar is used to set the outline Border for the Grid.


   <DataTemplate x:Key="DefaultCellTemplate">
     <Grid Background="AliceBlue">
       <TextBlock Text="{Binding Day}" Foreground="OrangeRed"
                  VerticalAlignment="Bottom" Margin="3"/>
 <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
   <Input:SfCalendar CellTemplate="{StaticResource DefaultCellTemplate}" Height="300" 
                     Width="500" BorderBrush="Violet">




The following screenshot shows the calendarDayButton customization with modified Border color




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