Date Navigations in UWP Scheduler (SfSchedule)
22 Jul 20264 minutes to read
Enabling Navigation
By default, Schedule views can be moved backwards and forwards using touch swipe gestures. This navigation gesture can be enabled or disabled by setting the EnableNavigation property of SfSchedule. By default, it is enabled.
<Page
...
xmlns:schedule="using:Syncfusion.UI.Xaml.Schedule">
<schedule:SfSchedule EnableNavigation="False"/>
</Page>using Syncfusion.UI.Xaml.Schedule;
//disabling the navigation gesture
schedule.EnableNavigation = false;Programmatically change to specific dates
Visible dates can be moved to a specific date using the MoveToDate method available in SfSchedule. It will move to any specific date if the schedule view is Day View; similarly, it will move to the specific week if it is week view, and to the specific month if it is month view.
Note: The specified date should lie between MinDisplayDate and MaxDisplayDate. If the specified date is greater than MaxDisplayDate, then the view moves to MaxDisplayDate. Similarly, if the specified date is lesser than MinDisplayDate, then the view moves to MinDisplayDate.
using Syncfusion.UI.Xaml.Schedule;
schedule.MoveToDate(new DateTime(2018, 1, 1));Programmatically change to specific time.
You can move the SfSchedule to a particular time by passing the TimeSpan value to the MoveToTime method. This method is applicable for Day, Week, and TimeLine views of the SfSchedule control.
Note: Since this method handles the position of the scroll, it should be called only after the SfSchedule view gets loaded. MoveToTime is only applicable in the day view of Windows Phone.
using Syncfusion.UI.Xaml.Schedule;
schedule.MoveToTime(new TimeSpan(8, 0, 0));Programmatically change to adjacent dates.
By default, the date can be navigated to the next and previous views using touch gestures, by swiping the control in the right-to-left and left-to-right direction. The view can also be changed programmatically using the Forward and Backward methods available in SfSchedule.
- Forward
- Backward
Forward
You can use the Forward method for viewing the next immediate visible dates in the SfSchedule. It will move to the next month if the schedule view is month; similarly, it will move to the next week for week view and the next day for day view.
using Syncfusion.UI.Xaml.Schedule;
//Viewing next immediate visible dates
schedule.Forward();Note: Date can be navigated until it reaches the Min and Max date.
Backward
You can use the Backward method for viewing the previous immediate visible dates in the SfSchedule. It will move to the previous month if the schedule view is month; similarly, it will move to the previous week for week view and the previous day for day view.
using Syncfusion.UI.Xaml.Schedule;
//Viewing previous immediate visible dates
schedule.Backward();Note: Date can be navigated until it reaches the Min and Max date.
Range for visible dates
Visible dates can be restricted between a certain range of dates using the MinimumDisplayDate and MaximumDisplayDate properties available in the SfSchedule control. It is applicable in all the schedule views.
Beyond the min and max date range, it will restrict the date navigation features of Forward, Backward, MoveToDate, and also you can’t swipe the control using touch gestures beyond the min and max date range.
using Syncfusion.UI.Xaml.Schedule;
schedule.MinimumDisplayDate = (new DateTime(2015, 9, 16));
schedule.MaximumDisplayDate = (new DateTime(2025, 11, 27));