Calendar for Xamarin.iOS: Navigation
This document describes the options to navigate between dates in TKCalendar
and the related notifications.
There are two methods in TKCalendar
used to navigate forward/backward in the calendar: NavigateForward
and NavigateBackward:
. These methods are context sensitive and the navigation period is specific to the current view mode (e.g. when using a week view the navigation period will be set to one week):
this.CalendarView.NavigateForward(true);
The calendar will not allow navigating to a date outside of the allowed period, specified by the MinDate
and MaxDate
properties:
this.CalendarView.MinDate = minDate;
this.CalendarView.MaxDate = maxDate;
The NavigateToDate
method is used to navigate to specific date within the allowed period:
NSDate date = NSDate.Now;
TkCalendar calendarView = new TKCalendar();
calendarView.NavigateToDate(newDate, true);
You can determine whether a navigation occurred by implementing TKCalendarDelegate
protocol.
You should implement the WillNavigateToDate
method if you want to be notified before this action occurs and DidNavigateToDate
method when action occured.
public override void DidNavigateToDate(TKCalendar calendar, NSDate date)
{
base.DidNavigateToDate(calendar, date);
}
public override void WillNavigateToDate(TKCalendar calendar, NSDate date)
{
base.WillNavigateToDate(calendar, date);
}