Time Regions in .NET MAUI Scheduler—An Overview

Jollen Moyani - Jun 2 '23 - - Dev Community

Time regions are specific units of time used to define periods or durations. The .NET MAUI Scheduler supports customizing time regions. This customization includes adjusting the duration of time regions, setting specific start and end times, handling interactions in time regions, and defining recurring time regions.

By having their time regions customized, schedulers become more efficient and tailored to individual needs. For instance, in a doctor’s scheduling application, time regions can be customized to account for lunch and break times, which can prevent appointment scheduling during those times. This customization is essential to ensure there are no conflicts between appointments and that sufficient time is allocated for rest and meals.

Time regions in .NET MAUI Scheduler

Time regions in .NET MAUI Scheduler

Note: If you are new to this control, refer to the .NET MAUI Scheduler getting started documentation before proceeding.

This blog will show you how to create and customize time regions in the .NET MAUI Scheduler control.

Defining the time region

Defining the time region requires the essential details in the following table.

Customization options

Summary

StartTime

Customize the time region start date and time.

EndTime

Customize the time region end date and time.

Background

Customize the time region background color.

Text

Customize the text rendered in the time region.

TextStyle

Customize the style for the time region text.

Interaction restriction on a time region

In the .NET MAUI Scheduler, the SchedulerTimeRegion class supports controlling, enabling, or disabling touch interaction for a time region using the EnablePointerInteraction property. It prevents touch interaction on disabled time slots.

Time region globalization

The time region feature provides globalization support, enabling users to customize time regions to align with different time zones or regional conventions using the TimeZone property. This can reduce errors when working across different time zones.

Recurring time region

The time region feature provides recurrence support to repeat the same time region on a regular or periodic interval using RecurrenceRule. For example, you can schedule a daily lunch break for a doctor’s appointment scheduling system.

For more details about the recurrence rule, refer to the recurrence rule documentation.

The recurring exception is an advanced feature of time region recurrence that allows the exclusion of specific occurrences of a recurring time region by using the RecurrenceExceptionDates property in the SchedulerTimeRegion class. This feature is useful when a regular schedule needs to be altered on a particular day or for a particular period, such as holidays or planned maintenance.

Resource-based time region

The time region feature provides resource support to create customized time slots based on specific resources or assets using the ResourceIds property. A resource-based time region defines the availability of those resources for scheduling.

Applying the time regions to .NET MAUI Scheduler

The .NET MAUI Scheduler uses the TimeRegions property in the SchedulerTimeSlotView class to customize the timeslots based on specified time regions and their properties such as StartTime , EndTime , Text , Background , and TimeZone.

SfScheduler scheduler = new SfScheduler();
scheduler.View = SchedulerView.Week;
ObservableCollection<SchedulerTimeRegion> timeRegions = new ObservableCollection<SchedulerTimeRegion>();

//// Adding time region in the scheduler time region collection.
timeRegions.Add(new SchedulerTimeRegion()
{
        StartTime = DateTime.Today.Date.AddHours(13),
        EndTime = DateTime.Today.Date.AddHours(14),
        Text = "Lunch",
        EnablePointerInteraction = false,
        RecurrenceRule = "FREQ=DAILY;INTERVAL=1",
});

//// Assigning the scheduler time region collection to the TimeRegions in DayView of .NET MAUI Scheduler.
scheduler.DaysView.TimeRegions = timeRegions;
this.Content = scheduler;
Enter fullscreen mode Exit fullscreen mode

Daily recurrence time region in .NET MAUI Scheduler

Daily recurrence time region in .NET MAUI Scheduler

Conclusion

Thank you for your time! This blog post showed you how to create and set a time region in the .NET MAUI Scheduler. You can explore other features in the Scheduler control in its documentation.

If you are not a Syncfusion customer, try our 30-day free trial to see how our components can enhance your projects.

Please try the samples available in our .NET MAUI sample location and share your feedback or ask questions in the comments section. Or contact us through our support forum, support portal, or feedback portal. We are happy to assist you!

Related blogs

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .