Hi,
I wanted to have a context menu i.e. on right click of any appointment with some menuitems that I can define (for e.g. Open, Edit, Delete, Copy etc..)
Can we define something like this. Please help.
Thanks & Regards,
Deven
You can hook up to the XamContextMenu's Opening event and in the event handler use the GetClickedElements() method off the event arguments object to obtain reference to the appointment that you clicked, otherwise you can cancel the opening:
<ig:ContextMenuService.Manager> <ig:ContextMenuManager OpenMode="RightClick"> <ig:ContextMenuManager.ContextMenu> <ig:XamContextMenu x:Name="mnuContext" Opening="mnuContext_Opening"> <ig:XamMenuItem x:Name="mnuName" Header="Some Header"/> </ig:XamContextMenu> </ig:ContextMenuManager.ContextMenu> </ig:ContextMenuManager> </ig:ContextMenuService.Manager>
private void mnuContext_Opening(object sender, OpeningEventArgs e) { var appointments = e.GetClickedElements<AppointmentPresenter>(); var appointment = appointments.SingleOrDefault(); if (appointment != null) { var activity = appointment.Activity; // do something with the activity } else { e.Cancel = true; } }
HTH,
Thanks for your reply.
I have been able to get a cotext meu on my XAMSchedule, however it opens throughout the XAMScedule. I want it to open only if it's being right-clicked on an empty/non-empty appointment.
I used the following the associate the context menu to my XAMSchedule.
Infragistics.Controls.Menus.
ContextMenuService.SetManager(xamScheduleView1, contextMenuManager1);
However, am not able to only associate it to some particular appointment/resources. Can you please help?
Regards,
Have you looked at our XamContextMenu? With it, you should be able to implement that kind of experience.