Copy Appointment with Drag and Drop

8 posts, 0 answers
  1. Friedhelm
    Friedhelm avatar
    9 posts
    Member since:
    Jul 2012

    Posted 13 Aug 2012 Link to this post

    Can the end-user also copy an appointment in MultiDayView or WeekDayView of the RadScheduler control by using the drag and drop function and pressing the "Ctrl-Key" ?
    a) from one Day to another day
    b) from von Time to another time at the same day

    Oh sorry, I see it's the wrong section here...please move it to RadScheduler

    Best Regards
    Friedhelm
  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 16 Aug 2012 Link to this post

    Hi Friedhelm,

    Thank you for writing.

    You can achieve the desired behavior in the AppointmentDropping event handler. Here is what you need to do:
    1. Cancel the drop operation - this will prevent the dragged appointment from moving.
    2. Creating the new Appointment and assign the desired properties from the dragged one (available in the event arguments).
    3. Set the new appointment start, by taking it from the NewDate property of the event arguments.

    Here is an example:
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
     
        private void Form1_Load(object sender, EventArgs e)
        {
            DateTime start = new DateTime(2012, 08,16,10,0,0,0);
            radScheduler1.Appointments.Add(new Appointment(start, start.AddHours(1), "Hello", "description", "USA"));
            radScheduler1.AppointmentDropping += new EventHandler<AppointmentMovingEventArgs>(radScheduler1_AppointmentDropping);
        }
     
        void radScheduler1_AppointmentDropping(object sender, AppointmentMovingEventArgs e)
        {
            if (ModifierKeys == Keys.Control)
            {
                e.Cancel = true;
     
                Appointment newApp = new Appointment();
                newApp.Summary = e.Appointment.Summary;
                newApp.Description = e.Appointment.Description;
                newApp.Location = e.Appointment.Location;
                newApp.Start = e.NewDate;
                newApp.Duration = e.Appointment.Duration;
                //add any properties that you need
                radScheduler1.Appointments.Add(newApp);
     
            }
        }
    }

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Friedhelm
    Friedhelm avatar
    9 posts
    Member since:
    Jul 2012

    Posted 16 Aug 2012 Link to this post

    Hi Stefan,
    thank you for the answer.

    But how can the end-user decide if he want copy or move the appointment, the windows standard solution is "press the Ctrl-Key while draging" or not.
    What's the solution in RadScheduler?

    Best regards
    Friedhelm
  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 21 Aug 2012 Link to this post

    Hello,

    Thank you for writing back.

    This is exactly what the provided code does - copy when Ctrl key is pressed and move when it is not. The check for the control key is the first line of code in the event handler:
    if (ModifierKeys == Keys.Control)

    Can you please give this approach a try and let me know whether it works for you?
     
    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  6. Friedhelm
    Friedhelm avatar
    9 posts
    Member since:
    Jul 2012

    Posted 21 Aug 2012 Link to this post

    Hi Stefan, sorry I was to fast with reading your answer.
    Now I've tried it.
    1. It is running using the WeekView - but it's not running using the MultiDayView. Here the radScheduler_AppointmentDropping() method is not called.
      So I can move an appointment but not copy it.
    2. How can I implement "user feedback" by showing the '+'-sign for the copy operation, usualy I do this by modifying the DragDropEffect.
      How does this work with RadScheduler?

    Best regards
    Friedhelm

  7. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 24 Aug 2012 Link to this post

    Hi Friedhelm,

    Thank you for writing.

    We are aware of the limitation where the radScheduler_AppointmentDropping is not fired in MultiDayView. This functionality is missing and we are currently working on implementing it. In fact we are working on reworking the whole drag and drop functionality of the control in order to make it easily customizable, extendable and easy to use. Hopefully, it will make it for Q3 2012.

    In regards to the plus sign, since this functionality is internally used and the resizing depends on it, we have to turn off the resizing during the dragging process. The whole approach is implemented in the attached project.

    I hope this helps.
     
    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  8. Thomas
    Thomas avatar
    22 posts
    Member since:
    Mar 2011

    Posted 28 Oct 2013 Link to this post

    "Hopefully, it will make it for Q3 2012."

    Did it make it?

    Sincerely, Thomas
  9. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 30 Oct 2013 Link to this post

    Yes it did Thomas. Feel free to take advantage of it.

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready