How to drop an appointment at the exact hour in the .NET MAUI Scheduler?
To drop an appointment precisely on the hour in the .NET MAUI Scheduler, you can handle the AppointmentDrop event. This document outlines the steps required to modify the dropped time to the nearest hour.
Step 1: Subscribe to the AppointmentDrop event of the Scheduler control.
C#
this.scheduler.AppointmentDrop += OnSchedulerAppointmentDrop;
Step 2: In the event handler, adjust the drop time to the nearest hour by setting the minutes and seconds to zero.
C#
private void OnSchedulerAppointmentDrop(object? sender, AppointmentDropEventArgs e)
{
var dropTime = e.DropTime;
e.DropTime = new DateTime(dropTime.Year, dropTime.Month, dropTime.Day, dropTime.Hour, 0, 0);
}
By implementing these steps, you can ensure that appointments dropped in the .NET MAUI SfScheduler will align with the exact hour.
Output
Download the complete sample on GitHub.
Conclusion
I hope you enjoyed learning how to configure the .NET MAUI Scheduler to ensure appointments are dropped on the hour.
You can refer to our .NET MAUI Scheduler’s feature tour page to know about its other groundbreaking feature representations. You can explore our .NET MAUI Scheduler documentation to understand how to present and manipulate data.
For current customers, you can check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our .NET MAUI Scheduler and other .NET MAUI components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!