Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1890
Dynamically creating Context Menu
posted

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.

 

CustomControl.zip
Parents Reply
  • 30945
    Suggested Answer
    Offline posted in reply to Decius

     

    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

     

Children