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

routing or delegating event to AppointmentEditDialogShowing event

4 Answers 69 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Noé
Top achievements
Rank 1
Noé asked on 12 Jun 2013, 02:37 PM
Hello.
* using C Sharp + WinForms

I have created a custom menu and when i attach it to Scheduler context menu, i can no longer access the AppointmentEditDialogShowing event.

What i am trying to do is populate the Start and End dates into my Custom New/Edit Appointment Dialog. If i use the default context menu, on the EditDialogShowing event, i can catch the dates using :

Telerik.WinControls.UI.Appointment app = (Telerik.WinControls.UI.Appointment)e.Appointment;
DateTime ini = app.Start;
DateTime end = app.End;
 
//cancel Scheduler Edit/new built in dialog
e.Cancel = true;
 
//Pass the values to my new/edit dialog and show it
.....

If i use my custom context menu, select a few empty cells and no longer know when it starts and ends. What can i do catch this dates using this ex: custom context menu ?

foreach (RadItem ri in e.ContextMenu.Items)
{
       ri.Visibility = ElementVisibility.Collapsed;
}
 
RadMenuItem rmi1 = new RadMenuItem("New / Edit Special Appointment");
rmi1.Click += new EventHandler(rmi1_Click);
 
RadMenuItem rmi2 = new RadMenuItem("Another Action");
rmi2.Click += new EventHandler(rmi2_Click);
 
 e.ContextMenu.Items.Add(rmi1);
 e.ContextMenu.Items.Add(rmi2);

4 Answers, 1 is accepted

Sort by
0
Noé
Top achievements
Rank 1
answered on 13 Jun 2013, 10:39 AM
little update.

while reading a bit a found i could use:
RadScheduler.CreateNewAppointmentCommand.ExecuteCommand(this.radScheduler1);
to show the AppointmentEditDialog from a new context menu item i have created, but when i reach the AppointmentEditDialogShowing event and do:

Telerik.WinControls.UI.Appointment app = (Telerik.WinControls.UI.Appointment)e.Appointment;
app is null. why ?
0
Peter
Telerik team
answered on 17 Jun 2013, 01:18 PM
Hi Noe,

Thank you for writing.

I am not sure that I fully understand your scenario by using the provided information. 
You can get the selected cells in the scheduler as follows:
List<SchedulerCellElement> cells = SchedulerUIHelper.GetSelectedCells(this.radScheduler1);
and each cell has a Date property which is the date which that cell is representing.

At this point the Appointment is not created yet and the purpose of this event is to allow changing the default appointment dialog. For example:
private void radScheduler_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
{
    e.AppointmentEditDialog = new MyEditAppointmentDialog();
}

In your custom edit appointment dialog, you should override the EditAppointment method and then in this method you will have access to the event.

I hope you find this useful.

Regards,
Peter
Telerik
RadChart for WinForms is obsolete. Now what?
0
Noé
Top achievements
Rank 1
answered on 17 Jun 2013, 04:19 PM
Hello Peter, thank you for the answer.
I was able to work with the cells snippet code.

About overriding the EditAppointment , i don't understand what i have to do. My EditControl does not extend the AppointmentEditDialog. I am not sure if this matters or not.
0
Peter
Telerik team
answered on 20 Jun 2013, 02:12 PM
Hi,

I am happy that you are able to access the cells.
Your control should inherit from AppointmentEditDialog. For more information how can do this please read this help article.

I hope this helps.

Regards,
Peter
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
Scheduler and Reminder
Asked by
Noé
Top achievements
Rank 1
Answers by
Noé
Top achievements
Rank 1
Peter
Telerik team
Share this question
or