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
1925
XamDataTree and XamDiagram to share same XamContextMenu
posted

Hi 

How can two infragistics controls share the same context menu. Say, I have xamdatatree and xamdiagram in a window and I wanted to have same context menu for both controls?

Thanks.

Parents
No Data
Reply
  • 34810
    Verified Answer
    Offline posted

    Hello Abs,

    In order to have the XamDiagram and the XamDataTree share essentially the same context menu, I would recommend defining your XamContextMenu as a resource and giving it an x:Key. This will allow you to access it by the key that you give it when you set up the ContextMenuManager needed to apply your XamContextMenu to a particular control. The ContextMenuManager has a ContextMenu property, and by defining your XamContextMenu as a resource, you can apply it using a StaticResource. An example XamDiagram using this method could look like the following:

    <ig:XamDiagram>
     <ig:ContextMenuService.Manager>
       <ig:ContextMenuManager ContextMenu="{StaticResource contextMenu}"/>
     </ig:ContextMenuService.Manager>
    </ig:XamDiagram>

    I have attached a sample project to demonstrate the above. I hope this helps.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    SharedMenuDemo.zip
Children