Skip to content

This sample demonstrates how to customize the .NET MAUI Calendar Control in a .NET MAUI Application.

Notifications You must be signed in to change notification settings

SyncfusionExamples/Customize-MAUI-Calendar-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Customize-MAUI-Calendar-Control

The .NET MAUI Calendar features a user-friendly interface with month, year, decade, and century views for easy navigation. In the month view, users can highlight special dates and weekends. The calendar supports the selection of a single date, multiple dates, or a range of dates. Additionally, it can display different types of calendars based on various cultures and regions.

This sample demonstrates how to customize the MAUI Calendar Control in a .NET MAUI Application. You'll see how to disable past dates and apply distinct backgrounds for past, present, and future dates.

You'll also learn how to display the calendar in a pop-up window, customize the appearance of selected dates, and highlight special dates.

Sample

<Grid>
    <calendar:SfCalendar x:Name="calendar"
                         EnablePastDates="True"
                         Mode="Dialog"
                         SelectionMode="Range"
                         StartRangeSelectionBackground="#bc05f7" 
                         EndRangeSelectionBackground="#bc05f7" 
                         SelectionBackground="#e6a2fc">
        
        <calendar:SfCalendar.HeaderView>
            <calendar:CalendarHeaderView Background="#03516b">
                <calendar:CalendarHeaderView.TextStyle>
                    <calendar:CalendarTextStyle TextColor="White" FontSize="14" />
                </calendar:CalendarHeaderView.TextStyle>
            </calendar:CalendarHeaderView>
        </calendar:SfCalendar.HeaderView>

        <calendar:SfCalendar.MonthView>
            <calendar:CalendarMonthView Background="#beedfa" 
                                        TodayBackground="#54b2cc" 
                                        TrailingLeadingDatesBackground="#A4DDED"
                                        SpecialDatesBackground="LightCyan">
                <calendar:CalendarMonthView.TodayTextStyle>
                    <calendar:CalendarTextStyle TextColor="White" />
                </calendar:CalendarMonthView.TodayTextStyle>
                <calendar:CalendarMonthView.TrailingLeadingDatesTextStyle>
                    <calendar:CalendarTextStyle TextColor="#8c2804" FontSize="12"/>
                </calendar:CalendarMonthView.TrailingLeadingDatesTextStyle>
            </calendar:CalendarMonthView>
        </calendar:SfCalendar.MonthView>

        <calendar:SfCalendar.YearView>
            <calendar:CalendarYearView Background="#beedfa"  
                                       TodayBackground="#54b2cc"
                                       LeadingDatesBackground="#A4DDED">
                <calendar:CalendarYearView.TodayTextStyle>
                    <calendar:CalendarTextStyle TextColor="White"/>
                </calendar:CalendarYearView.TodayTextStyle>
                <calendar:CalendarYearView.LeadingDatesTextStyle>
                    <calendar:CalendarTextStyle TextColor="#8c2804" FontSize="12"/>
                </calendar:CalendarYearView.LeadingDatesTextStyle>
            </calendar:CalendarYearView>
        </calendar:SfCalendar.YearView>
    </calendar:SfCalendar>

    <Button x:Name="calendarButton"
            Text="Open Calendar"
            Clicked="Button_Clicked"
            HorizontalOptions="Center"
            VerticalOptions="Center"
            HeightRequest="50" 
            WidthRequest="150">
    </Button>
</Grid>

Requirements to run the demo

To run the demo, refer to System Requirements for .NET MAUI

Troubleshooting:

Path too long exception

If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.

License

Syncfusion has no liability for any damage or consequence that may arise from using or viewing the samples. The samples are for demonstrative purposes. If you choose to use or access the samples, you agree to not hold Syncfusion liable, in any form, for any damage related to use, for accessing, or viewing the samples. By accessing, viewing, or seeing the samples, you acknowledge and agree Syncfusion's samples will not allow you seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize, or otherwise do anything with Syncfusion's samples.

About

This sample demonstrates how to customize the .NET MAUI Calendar Control in a .NET MAUI Application.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages