Category / Section
How to show time indicator on a specific time when dragging an appointment in Xamarin.Forms Schedule (Sfschedule)
1 min read
You can show the popup on specific time when do drag and drop the appointment in Xamarin.Forms SfSchedule by using the DragDropSetting ShowTimeIndicator property in a AppointmentDragOver event
C#
ShowTimeIndicator property updated in AppointmentDragOver event based on the dragging time.
public class ScheduleBehavior : Behavior<ContentPage>
{
SfSchedule schedule;
protected override void OnAttachedTo(ContentPage bindable)
{
base.OnAttachedTo(bindable);
schedule = bindable.FindByName<SfSchedule>("schedule");
schedule.AppointmentDragOver += schedule_AppointmentDragOver;
}
private void schedule_AppointmentDragOver(object sender, AppointmentDragEventArgs e)
{
if (e.DraggingTime.Minute == 30 || e.DraggingTime.Minute == 00)
{
schedule.DragDropSettings.ShowTimeIndicator = true;
}
else
schedule.DragDropSettings.ShowTimeIndicator = false;
}
protected override void OnDetachingFrom(ContentPage bindable)
{
base.OnDetachingFrom(bindable);
schedule.AppointmentDragOver += schedule_AppointmentDragOver;
}
}
Output
