This is a migrated thread and some comments may be shown as answers.

Copy Appointment with Drag and Drop

7 Answers 112 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Friedhelm
Top achievements
Rank 1
Friedhelm asked on 13 Aug 2012, 01:25 PM
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

7 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 16 Aug 2012, 11:00 AM
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 >>
0
Friedhelm
Top achievements
Rank 1
answered on 16 Aug 2012, 11:16 AM
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
0
Stefan
Telerik team
answered on 21 Aug 2012, 05:26 AM
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 >>
0
Friedhelm
Top achievements
Rank 1
answered on 21 Aug 2012, 08:23 AM
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

0
Stefan
Telerik team
answered on 24 Aug 2012, 08:00 AM
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 >>
0
Thomas
Top achievements
Rank 1
answered on 28 Oct 2013, 12:58 PM
"Hopefully, it will make it for Q3 2012."

Did it make it?

Sincerely, Thomas
0
Stefan
Telerik team
answered on 30 Oct 2013, 07:23 AM
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 >>
Tags
Scheduler and Reminder
Asked by
Friedhelm
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Friedhelm
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Share this question
or