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

Drag drop appointment and open dialog after drop

3 Answers 61 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 14 Mar 2012, 11:25 AM
Hi,

I've been following this example which works great
:
http://www.telerik.com/help/winforms/scheduler-appointments-and-dialogs-drag-and-drop-from-another-control.html

What I would like to do is once I have dropped the appointment I would like the apppointment dialog box to open so I can enter some addtional data. I am also using the CustomEditAppointmentDialog example so I can use my own fields etc.

Is this possible, I've tried firing the _AppointmentEditDialogShowing event but can't pas the appointment details ie times etc it comes up with a invalid cast.

Thanks

3 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 16 Mar 2012, 02:03 PM
Hi Karl,

Thank you for your question.

Yes, you can achieve this by calling the ShowAppointmentEditDialog of RadScheduler after you have added the appointment to the Appointments collection. The following code snippet demonstrates how you should modify the radScheduler1_DragDrop method of the mentioned help article in order to achieve the desired behavior:
private void radScheduler1_DragDrop(object sender, DragEventArgs e)
{
    Point point = this.radScheduler1.PointToClient(new Point(e.X, e.Y));
 
    DayViewAppointmentsTable table = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Table;
    SchedulerCellElement schedulerCell = SchedulerUIHelper.GetCellAtPoint(point, table.Children);
    if (schedulerCell != null)
    {
        DragObject dragObject = e.Data.GetData(typeof(DragObject)) as DragObject;
        if (dragObject != null)
        {
            this.radScheduler1.Appointments.BeginUpdate();
            Appointment appointment = CreateAppointment(schedulerCell.Date, dragObject);
            this.radScheduler1.Appointments.Add(appointment);
            this.radScheduler1.Appointments.EndUpdate();
 
            this.radScheduler1.ShowAppointmentEditDialog(appointment, false);
        }
    }
 
    this.mouseDownPosition = Point.Empty;
    this.isDragging = false;
}

I hope you find this useful. Do let me know if you have any additional questions.

Kind regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Karl
Top achievements
Rank 1
answered on 16 Mar 2012, 03:01 PM
Hi,

Thanks for the reply, this works to open the dialog but still doesn't allow me to access my custom fields.

This would work if I doubled click to add an appointment.

Would I need to do anything else?

Thanks
0
Ivan Todorov
Telerik team
answered on 21 Mar 2012, 10:34 AM
Hello Karl,

The reason might be that you are instantiating the default Appointment type on the DragDrop event where you should instantiate your custom appointment type instead. However, I am not sure if this is the case, because I do not have the source code of your project. Therefore I have prepared a small sample project which implements the desired scenario. I hope you find it useful.

If you have any further questions, I will be glad to answer them.

Greetings,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
Scheduler and Reminder
Asked by
Karl
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Karl
Top achievements
Rank 1
Share this question
or