Articles in this section
Category / Section

How to Navigate to a Specific Month in the .NET MAUI Calendar (SfCalendar)?

3 mins read

In the Syncfusion® .NET MAUI Calendar control, you can navigate to a specific month using the DisplayDate property of the SfCalendar.

 

Step 1: Create a ViewModel class and add a MoveToDate property with a specific date.

 

C#

public class ViewModel : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
 
    private DateTime moveToDate = new DateTime(2050, 11, 25);
 
    public DateTime MoveToDate
    {
        get
        {
            return this.moveToDate;
        }
        set
        {
            this.moveToDate = value;
            this.OnPropertyChanged(nameof(MoveToDate));
        }
    }
 
    public ViewModel()
    {
    }
 
    private void OnPropertyChanged(string propertyName)
    {
        this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}

 

Step 2: Bind the MoveToDate ViewModel property to the DisplayDate property of the SfCalendar.

 

XAML

<calendar:SfCalendar x:Name="calendar"
                     DisplayDate="{Binding MoveToDate}">
    <calendar:SfCalendar.BindingContext>
        <local:ViewModel />
    </calendar:SfCalendar.BindingContext>
</calendar:SfCalendar>

 

Note:

You can set a specific date to the DisplayDate property of SfCalendar directly in the main page. The date can be formatted as “yyyy/MM/dd”, “yyyy MM dd”, “yyyy,MM,dd”, or “yyyy.MM.dd”.

 

XAML

<calendar:SfCalendar x:Name="calendar"
                     DisplayDate="2050,11,25" />

 

Download the complete sample on GitHub

 

Output

 

Month navigation using Syncfusion .NET MAUI Calendar

 

Conclusion

I hope you enjoyed learning how to navigate to a specific month in the .NET MAUI Calendar (SfCalendar).

You can refer to our .NET MAUI Calendar’s feature tour page to know about its other groundbreaking feature representations. 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 comments below. You can also contact us through our support forumsDirect-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