How to programatically change the selected date in Xamarin.Forms Calendar (SfCalendar) and make to SfCalendar show my selected date?

https://www.syncfusion.com/kb/9312/how-to-customize-calendar-header

In this article I understood how to change a day. I need to change a month/year.For example Now is July 2021.but I want to show September 2021 or September 2022 on the default.Please help me and say how can I do it.Because if I use 

        private DateTime selectedDate = DateTime.Now.AddMonths(-5);

it make this date in purple circe but default month is July


1 Reply

SS SaiGanesh Sakthivel Syncfusion Team July 30, 2021 06:43 AM UTC

Hi Maria, 
 
Thank you for contacting Syncfusion support. 
 
#Regarding How to display the selected date in the view 
We have checked the reported query from our end. Your requirement can be achieved by using MoveToDate property in the SfCalendar. Please refer to the following code snippet for your reference. 
 
Code Snippet 
<calendar:SfCalendar x:Name="calendar" 
                        DataSource="{Binding Appointments}" 
                        SelectedDate="{Binding SelectedDate}" 
                        MoveToDate="{Binding SelectedDate}"> 
    <calendar:SfCalendar.BindingContext> 
        <local:ViewModel/> 
    </calendar:SfCalendar.BindingContext> 
</calendar:SfCalendar> 
 
We have prepared the sample and attached in the following link for your reference. 
   
 
Please let us know if you need any further assistance. 
 
Regards,
SaiGanesh Sakthivel


Loader.
Up arrow icon