Navigation and Gesture

Move to Date

Visible dates can be moved to specific date using MoveToDate property available in SfCalendar. It will move to any specific month,year,decade,century view based on the ViewMode.

  • c#
  • NSCalendar date = NSCalendar.CurrentCalendar;
    NSDate today = new NSDate();
    NSDateComponents movetoDateComponents = date.Components(
            NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today);
    
    movetoDateComponents.Year = 2015;
    movetoDateComponents.Month = 4;
    movetoDateComponents.Day = 1;
    
    NSDate moveToDate = date.DateFromComponents(movetoDateComponents);
    calendar.MoveToDate(moveToDate);

    NOTE

    The specified date should lie between MinDate and MaxDate, if the specified date is greater than MaxDate then the view will be moved to MaxDate and if the specified date is lesser than the MinDate then the view will be moved to MinDate.

    Toggle navigation

    This navigation, using touch gesture can be enabled and disabled using NavigationEnable property available in SfCalendar control. By default, NavigationEnable property is enabled.

    NOTE

    By default, SfCalendar views can be moved backwards and forwards using touch swipe gesture.

  • c#
  • calendar.ViewMode = SFCalendarViewMode.SFCalendarViewModeMonth;
    calendar.EnableNavigation = false;