I'm using a Custom Context menu for the ScheduleControl Control and I want to do the following: Depending on where I right clicked on the schedulegrid (where the appointments are showed) I want to filter out some menu entries in my Context menu.
(For example: If I right click on a time slot where there is no appointment, some entries should be available only but if I right click on an appointment other entries should be available in my context menu etc.)
The base of the question, how to know that which appointment item is under the mouse when I right click.
Can you help me in this issue?
JJ
Jisha Joy
Syncfusion Team
February 24, 2009 05:01 AM UTC
Hi,
Thank you for interest in Syncfusion Products.
The deisired behavior can be achieved by handling ScheduleAppointmentClick event. Please see the code:
this.scheduleControl.ScheduleAppointmentClick += new ScheduleAppointmentClickEventHandler(scheduleControl_ScheduleAppointmentClick);
this.scheduleControl.GetScheduleHost().ContextMenu.MenuItems.Clear();
void scheduleControl_ScheduleAppointmentClick(object sender, ScheduleAppointmentClickEventArgs e)
{
if (e.ClickType == ScheduleAppointmentClickType.RightClick)
{
this.contextMenuStrip1.Items.Clear();
if (e.Item != null)
{
this.contextMenuStrip1.Items.Add(e.Item.ToString());
this.contextMenuStrip1.Items.Add(e.ClickDateTime.ToString());
}
else
{
this.contextMenuStrip1.Items.Add("No appointment");
}
this.contextMenuStrip1.Show(MousePosition.X, MousePosition.Y);
}
}
Please let me know if this helps.
Regards,
Jisha
GU
Gergo Ujvari
February 24, 2009 09:22 AM UTC
Thank you for your reply.
Your code was the solution I was looking for.
Thanks again for your help!
JJ
Jisha Joy
Syncfusion Team
February 24, 2009 10:21 AM UTC
Hi,
Thank you for your update.
Regards,
Jisha