SkillAgentSearch skills...

XCalendar

A cross-platform plugin for .NET providing an API for representing a calendar along with fully customisable calendar controls for .NET MAUI and Xamarin Forms

Install / Use

/learn @ME-MarvinE/XCalendar

README

XCalendar

A cross-platform plugin for .NET providing a Calendar API and DateTime extensions.

UI controls are available for Xamarin Forms and .NET MAUI, able to run on any platform the respective framework supports.

Features

  • Ability to use the Calendar from code without referencing a UI framework.
  • Ability to use and reference your own models by implementing interfaces like ICalendar, ICalendarDay, or IEvent.
  • Ability to set the number of rows/weeks shown or have it be automatic.
  • Ability to change the start of the week to any day of the week.
  • Ability to select single, multiple or a range of dates.
  • Ability to specify a selection direction, for example restricting range selection from start to finish or finish to start
  • Ability to restrict navigation to a range of dates and define how the calendar loops.
  • Ability to specify your own custom order of days of week, with support for duplicates and non-chronological orders.
  • Fully customisable CalendarView with custom controls, templates, and exposed default styles and commands.
  • Support for localising text (such as days of the week and day numbers).
  • And more!

Roadmap

Features (Xamarin Forms/MAUI)

  • Default calendar control that exposes many customisation properties, making the calendar easier to use out-of-the-box instead of requiring usage of templates and styles.
  • Default implementation of selection and navigation commands, making the calendar easier to use out-of-the-box.
  • Default feature-based calendar controls such as "EventCalendar"/"AppointmentCalendar".
  • Some type of time schedule control Discussion 153
  • Culture/Locale property for CalendarView
  • YearView
  • DecadeView
  • CenturyView
  • Day, Month, and year properties as an alternative to NavigatedDate.

Maui Community Toolkit

Follow the discussion for moving XCalendar into the Maui Community Toolkit here.

Images

Standard Calendar

<img src="https://user-images.githubusercontent.com/73718829/181294940-a12bfe05-6caa-473f-9cb4-a862927931e9.jpg" width="45%">

Custom Days Of Week (Unordered/Duplicates)

<img src="https://user-images.githubusercontent.com/73718829/181294949-1bd0e011-c0b4-4641-a779-e0f4215f4317.jpg" width="45%">

Custom Days Of Week (3 Days Of Week)

<img src="https://user-images.githubusercontent.com/73718829/181294956-50c49fa6-bcd4-4409-8504-7edd08cb5b52.jpg" width="45%">

Custom Week Amount (1 Week)

<img src="https://github.com/user-attachments/assets/a7b3a9ad-2941-45d3-9e1e-caee88e09d03" width="45%">

Custom Week Amount (2 Weeks)

<img src="https://github.com/user-attachments/assets/a2527e06-c925-42bd-aa7f-86871f88c0bf" width="45%">

Day Styles

<img src="https://user-images.githubusercontent.com/73718829/181294977-bcb4c74c-8ae5-4289-b841-efec946d87d5.jpg" width="45%">

Sample App

The sample app has a flyout menu where you can access the following pages:

Playground Page

A page where you can modify almost every single property of the CalendarView. Perfect for a quick look, showcases, tests and experiments!

<img src="https://user-images.githubusercontent.com/73718829/181289378-28512c2b-e3b4-415a-b720-24b8130866ef.jpg" width="45%"> <br/> <img src="https://user-images.githubusercontent.com/73718829/181290783-3655cf46-2275-467c-8507-8a31553ef36f.jpg" width="45%"> <br/> <img src="https://user-images.githubusercontent.com/73718829/181290789-a56b2517-f6cf-4cbc-a140-568707750e39.jpg" width="45%"> <br/> <img src="https://user-images.githubusercontent.com/73718829/181290791-1ebb26b2-24e7-4dc4-b086-5295a4b14ab0.jpg" width="45%"> <br/> <img src="https://user-images.githubusercontent.com/73718829/181291657-9c4570d8-37a2-4909-9a68-4d833279ebba.jpg" width="45%">

Examples Page

A page where you can search for examples of how to use XCalendar.

<img src="https://user-images.githubusercontent.com/73718829/209573500-f96f9d88-2e58-43c0-9cdd-cf1cd94fd3ce.png" width="45%">

Examples include:

Event Calendar

<img src="https://user-images.githubusercontent.com/73718829/181292097-ada95992-e480-44c2-aec6-a3f48813ea01.jpg" width="45%">

Custom DatePicker Dialog

<img src="https://user-images.githubusercontent.com/73718829/181292138-35f29f2f-877a-4245-a87d-9c7d7ecd1383.jpg" width="45%"> <img src="https://user-images.githubusercontent.com/73718829/181292154-a4db3661-ece5-4cac-8ee6-76542d6ef34f.jpg" width="45%">

Selection

<img src="https://user-images.githubusercontent.com/73718829/181292178-517627b1-2603-4b95-94e4-3232ef1961d5.jpg" width="45%">

Using DayView

<img src="https://user-images.githubusercontent.com/73718829/209572305-294451f5-b62f-44bb-b330-5ba44309d1ae.png" width="45%">

Customising A Day

<img src="https://user-images.githubusercontent.com/73718829/209572332-b78a457e-7c1c-44d8-9d48-1124efe837c1.png" width="45%">

Animated Swipable Calendar

https://user-images.githubusercontent.com/73718829/209573341-b506e399-631b-4cdd-b840-d17bb5ddfb85.mp4

Connecting Selected Days

<img src="https://user-images.githubusercontent.com/73718829/231608640-2ab28bb0-d802-4fdb-b84d-bc5e00da571a.png" width="45%">

Duolingo Streak Calendar

| Official App | Sample App | | ------------ | ---------- | | <img src="https://github.com/ME-MarvinE/XCalendar/assets/73718829/1663a8df-9c7e-4e23-8a5d-3c981bcc030d" width="100%"> | <img src="https://github.com/ME-MarvinE/XCalendar/assets/73718829/276d2a66-ef58-4425-af45-791d3100decb" width="100%"> |

Basic Usage

.NET

Install the NuGet package

  • https://www.nuget.org/packages/XCalendar.Core NuGet

Now you can use the Calendar

public Calendar MyCalendar { get; set; } = new Calendar();

Xamarin Forms

Install the NuGet package

  • https://www.nuget.org/packages/XCalendar.Forms NuGet

Create a Calendar in your ViewModel

public Calendar MyCalendar { get; set; } = new Calendar();

Add the following xmlns to your page or view

xmlns:xc="clr-namespace:XCalendar.Forms.Views;assembly=XCalendar.Forms"

Bind to the properties of your Calendar

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="App1.MainPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:xc="clr-namespace:XCalendar.Forms.Views;assembly=XCalendar.Forms">
    
        <xc:CalendarView
            Days="{Binding MyCalendar.Days}"
            DaysOfWeek="{Binding MyCalendar.DayNamesOrder}"
            NavigatedDate="{Binding MyCalendar.NavigatedDate}"/>

</ContentPage>

Alternatively, these properties can be set directly from code-behind without the use of MVVM.

Youtube Tutorial (Outdated - Uses version 1.2.1 for Xamarin Forms)

Beautiful, Extensive and FREE Calendar Control for Xamarin.Forms

.NET MAUI

Install the NuGet package

  • https://www.nuget.org/packages/XCalendar.Maui NuGet

Create a Calendar in your ViewModel

public Calendar MyCalendar { get; set; } = new Calendar();

Add the following xmlns to your page or view

xmlns:xc="clr-namespace:XCalendar.Maui.Views;assembly=XCalendar.Maui"

Bind to the properties of your Calendar

<ContentPage
    x:Class="MauiApp1.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:xc="clr-namespace:XCalendar.Maui.Views;assembly=XCalendar.Maui">
    
        <xc:CalendarView
            Days="{Binding MyCalendar.Days}"
            DaysOfWeek="{Binding MyCalendar.DayNamesOrder}"
            NavigatedDate="{Binding MyCalendar.NavigatedDate}"/>

</ContentPage>

Alternatively, these properties can be set directly from code-behind without the use of MVVM.

Navigation Overview

Calendar

Navigation can be performed by setting the NavigatedDate property of the Calendar.

Alternatively, navigation can be performed using the Navigate method; it takes a parameter specifying the TimeSpan to navigate by. The Calendar can handle exceptions caused by non-representable dates such as DateTime.MaxValue.AddDays(1).

Variable time units such as months can be obtained by using the'AddMonths' method on a DateTime and subtracting the result from the current date. The 'TryAdd' and 'TrySubtract' methods in DateTimeExtensions are useful if you ever plan to navigate to the

View on GitHub
GitHub Stars332
CategoryDevelopment
Updated16d ago
Forks39

Languages

C#

Security Score

100/100

Audited on Mar 11, 2026

No findings