Copying appointments (between resources)

2 posts, 0 answers
  1. AMF
    AMF avatar
    36 posts
    Member since:
    Mar 2011

    Posted 08 Dec 2011 Link to this post


    I've been wanting to implement a copy function for appointments but I can't get it quite right.

    The idea is simple, you have a form with a scheduler, which views multiple resources. When you start dragging and keep the control key pressed, you don't actually move the appointment but you copy it.

    My code looks like this:

    void rdSchedule_AppointmentDropping(object sender, AppointmentMovingEventArgs e)
                if (ModifierKeys == Keys.Control)
                    if (e.Appointment is AmfAppointment)
                        AmfAppointment copiedAppointment = ((AmfAppointment)e.Appointment).Copy();
                        copiedAppointment.Start = e.NewDate;
                        e.Cancel = true;

    rdSchedule is the Scheduler control.

    AmfAppointment is my own inheritance of an Appointment and Copy() is a function to duplicate the Appointment.

    This only (seems to, still some bugs to work out) work for copying an appointment to the same resources.

    When dragging the appointment to another resource nothing happens.

    Also; the AppointmentMovingEventArgs has a NewDate but no NewResource (i.e.)? And the e.Appointment.ResourceId is the old ResourceId so I can't get it from there either.

    What is the right approach here? And if so how can I make this work for copying between different resources as well?

    Thank you!

  2. Ivan Todorov
    Ivan Todorov avatar
    688 posts

    Posted 13 Dec 2011 Link to this post

    Hello Amf,

    Thank you for contacting us.

    This is happening because e.Appointment is not the same instance as the original appointment when you drag appointments between resources. This is an issue and it was reporter previously by one of our clients. Here is the PITS item about it. It describes a bit different issue, but it was caused by the same reason.

    The issue will be addressed in the upcoming service pack which should be available for download next week. Also, a property called NewResourceId will be added to the event args so you can easily handle scenarios with grouped view. For the time being, I cannot provide you with a workaround due to the internal implementation of this functionality.

    Should you have additional questions, do not hesitate to ask.

    Kind regards,
    Ivan Todorov
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Back to Top