Skip to content

This repository contains a sample on How to navigate to the specific month in the Syncfusion Xamarin.Forms Calendar (SfCalendar)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/move-to-date-calendar-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to navigate to the specific month in Xamarin.Forms Calendar (SfCalendar)

Visible dates can be moved to specific date using MoveToDate property available in SfCalendar. It is applicable for all the ViewMode.

You can also refer the following article.

https://www.syncfusion.com/kb/11832/how-to-navigate-to-the-specific-month-in-xamarin-forms-calendar-sfcalendar

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

public class ViewModel : INotifyPropertyChanged
{
   public event PropertyChangedEventHandler PropertyChanged;

   private DateTime moveToDate = new DateTime(2010, 10, 12);

   public DateTime MoveToDate
   {
     get
     {
          return this.moveToDate;
     }
     set
     {
          this.moveToDate = value;
          this.OnPropertyChanged("MoveToDate");
     }
   }

   public ViewModel()
   {
   }

   private void OnPropertyChanged(string propertyName)
   {
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
   }
}

STEP 2: Bind the MoveToDate ViewModel property to the MoveToDate property of SfCalendar.

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

Output

MoveToDate

About

This repository contains a sample on How to navigate to the specific month in the Syncfusion Xamarin.Forms Calendar (SfCalendar)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages