How to restrict visible date range in the WINUI Calendar (SfCalendar)
In the WinUI Calendar, you can restrict the visible date ranges using the MinDate and MaxDate property of the calendar.
XAML
<Window x:Class="MinMaxCalendar.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MinMaxCalendar" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:calendar="using:Syncfusion.UI.Xaml.Calendar"> <Grid> <calendar:SfCalendar Name="sfCalendar"> </calendar:SfCalendar> </Grid> </Window>
CS
When the MinDate and MaxDate is set to the calendar you cannot swipe beyond those dates.
sfCalendar.MinDate = new DateTimeOffset(new DateTime(2021, 03, 9)); sfCalendar.MaxDate = new DateTimeOffset(new DateTime(2021, 03, 23));
