Dynamically creating Context Menu

Answered (Not Verified) This post has 0 verified answers | 9 Replies | 3 Followers Thread's RSS feed.

dvickerie
Points 1,375
Replied On: Mon, Jun 11 2012 10:32 AM Reply

I created a custom control XamDatagrid. I want to add two standard context menu headers dynamically. How can I add them and trigger there events. In my current project, I can add them but I'm unable to trigger there events. Is that possible? Also if a another programmer uses my control and adds other context menu items will it override mines? Attached is my sample project.

 

  • Post Points: 20

All Replies

[Infragistics]Stefan
Points 77,843
Replied On: Mon, Jun 18 2012 3:25 AM Reply

Hello,

 

Thank you for your post. I have been looking into it and the sample you have attached, but I am not completely sure how do you add your ContextMenus, so could you please modify the sample, so there are the ContextMenus in order to be able to investigate your issue further.

 

Looking forward for your reply.

Sincerely,
Stefan, MCPD
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support

  • Post Points: 20
dvickerie
Points 1,375
Replied On: Mon, Jun 18 2012 10:02 AM Reply

I have attached a better sample for you. In this sample created a context manager then added menu items to it. However when the custom control is dropped on the page and I try to added new items they dont show up. If I try to added the dynamic menu items in the datagrid loaded event their events never fire off.

  • Post Points: 20
Answered (Not Verified) Replied On: Mon, Jun 25 2012 5:25 AM Reply

7851.CustomControl_1.zip

 

Hello,

 

Thank you for the clarification and the attached sample application. If I understand correctly, you wish to add additional items to the XamContextMenu, which is added to the AwrdsDataGrid class. If this is correct, I can suggest using the GetManager method of the ContextMenuService class and pas the AwrdsDataGrid to the method. When you have the ContextMenuManager, you can get the XamContextMenu, through the ContextMenu property of the ContextMenuManager and add ContextMenuItems to its Items collection. Also you can handle the clicked events of the newly added XamMenuItems and when press the items the events  are firing. I have modified the sample application, you have attached in order to demonstrates how to do that.

 

Please let me know if this is what you are looking for or I have misunderstood you in any way.

 

Sincerely,

Krasimir

Developer Support Engineer

Infragistics

www.infragistics.com/support

 

  • Post Points: 5
Replied On: Thu, Jun 28 2012 11:58 AM Reply

Hello,

 

I am just checking if you require any further assistance on the matter.

 

Sincerely, 

Krasimir

Developer Support Engineer

Infragistics

www.infragistics.com/support

  • Post Points: 20
dvickerie
Points 1,375
Replied On: Thu, Jun 28 2012 12:28 PM Reply

This helped thank you. So pretty much I have to set my menu items dynamically?

  • Post Points: 20
Replied On: Sun, Jul 1 2012 5:47 AM Reply

Hello,

 

Thank you for your reply. I have further researched the functionality that you are looking for and it seems that the best approach for adding items to an existing XamContextMenu is getting the ContextMenuManager and then adding the items to its ContextMenu property.

 

Please let me know if you need any further assistance on the matter.

 

Sincerely,

Krasimir

Developer Support Engineer

Infragistics

www.infragistics.com/support

  • Post Points: 20
dvickerie
Points 1,375
Replied On: Mon, Jul 2 2012 10:43 AM Reply

Ok thank you for your message

  • Post Points: 5
dvickerie
Points 1,375
Replied On: Mon, Jul 2 2012 10:46 AM Reply

I meant thank you for your help

  • Post Points: 20
Replied On: Mon, Jul 2 2012 1:49 PM Reply

Hello,

 

Thank you for your feedback. Please let me know if you need any further assistance on the matter.

 

Sincerely,

Krasimir

Developer Support Engineer

Infragistics

www.infragistics.com/support

  • Post Points: 5
Page 1 of 1 (10 items) | RSS