Articles in this section
Category / Section

How to Change the Weekend Dates in the .NET MAUI Calendar (SfCalendar)?

3 mins read

In the Syncfusion .NET MAUI Calendar, you can change the weekend days of the week by using the WeekendDays property of the SfCalendar.

 

Step 1: Create a ViewModel class and add a property WeekendDayList to specify the weekend days and bind that property into the CalendarMonthView’s WeekendDays property of the SfCalendar, as shown in the following code sample.

 

C#

public class CalendarViewModel
{
    public List<DayOfWeek> WeekendDayList { get; set; }
 
    public CalendarViewModel()
    {
        this.WeekendDayList = new List<DayOfWeek>() { DayOfWeek.Monday, DayOfWeek.Friday };
    }
}

 

XAML

<ContentPage.BindingContext>
    <local:CalendarViewModel />
</ContentPage.BindingContext>
<ContentPage.Content>
    <calendar:SfCalendar x:Name="calendar">
        <calendar:SfCalendar.MonthView>
            <calendar:CalendarMonthView WeekendDays="{Binding WeekendDayList}">
            </calendar:CalendarMonthView>
        </calendar:SfCalendar.MonthView>
        
    </calendar:SfCalendar>
</ContentPage.Content>

 

Step 2: Customize the weekend days background and text appearance using the WeekendDatesBackground and WeekendDatesTextStyle properties of the CalendarMonthView to highlight the weekend days, as shown in the following code sample.

 

XAML

<calendar:CalendarMonthView WeekendDays="{Binding WeekendDayList}"
                            WeekendDatesBackground="LightGray">
    <calendar:CalendarMonthView.WeekendDatesTextStyle>
        <calendar:CalendarTextStyle TextColor="Red"
                                    FontSize="15"
                                    FontAttributes="Italic"/>
    </calendar:CalendarMonthView.WeekendDatesTextStyle>
</calendar:CalendarMonthView>

 

Output:

 

Weekend days change in Syncfusion .NET MAUI Calendar

 

Conclusion:

 

Hope you enjoyed learning about how to change the weekend dates in the .NET MAUI Calendar (SfCalendar).

You can refer to our .NET MAUI Calendar’s feature tour page to learn about its other groundbreaking feature representations. You can explore our .NET MAUI Calendar documentation to understand how to present and manipulate data.

For current customers, you can check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET MAUI Calendar and other .NET MAUI components.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

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