Articles in this section
Category / Section

How to get dropped resource in Xamarin.Forms Schedule (SfSchedule)

1 min read

You can get the dropped resource of SfSchedule in Xamarin.Forms using DropResourceItem in the AppointmentDrop event.

XAML

<syncfusion:SfSchedule
                x:Name="schedule"
                AllowAppointmentDrag="true"
                ScheduleView="TimelineView" 
                DataSource="{Binding Events}"
                ScheduleResources="{Binding Employees}"
                SelectedResources="{Binding SelectedEmployees}"
                ShowResourceView="True"
                ResourceViewMode="Absolute"/>

C#

public class SchedulerPageBehavior : Behavior<ContentPage>
{
    SfSchedule schedule;
 
    private void WireEvents()
    {
        this.schedule.AppointmentDrop += Schedule_AppointmentDrop;
    }
 
    private void Schedule_AppointmentDrop(object sender, AppointmentDropEventArgs e)
    {
        var changedResource = e.DropResourceItem;
        App.Current.MainPage.DisplayAlert("", "Resorce change into " + (changedResource as Employee).Name, "ok");
    }
 
    private void UnWireEvents()
    {
        this.schedule.AppointmentDrop -= Schedule_AppointmentDrop;
    }
}

Download sample in GitHub

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment