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
340
How to select diagram item when right click on diagram for showing context Menu?
posted

Hi,

I have added context menu on XAMDiagram. but I want that as I  right click on any diagram that time diagram should be select and Context Menu should be shown. Right now I have added context menu for XAMDiagram so as we right click on diagram area then context menu showing. But we want to show context menu when we right click on diagram and that time diagram should be select and context should be appear.

we want to show context menu for selected diagram. Please help us for that.

Thanks

Parents
  • 34690
    Suggested Answer
    Offline posted

    Hello piyu,

    Thank you for your post!

    From your description, it sounds like you have applied a context menu to the XamDiagram itself, and are trying to select the nodes and connections on right click, but still show that context menu. Please let me know if this initial impression is incorrect, as the following goes off of that impression.

    To achieve this requirement, I would recommend writing a pair of implicit styles in your XamDiagram.Resources section. The target types of these styles can be for DiagramNode and DiagramConnection. I would recommend having these styles do essentially the same thing, in that they use an EventSetter to hook into the PreviewMouseRightButtonDown event, and since these styles are implicit, this will take effect on every node and connection in the diagram. Then, in the event handlers for the respective PreviewMouseRightButtonDown events, you can cast the sender of the event to the corresponding object type, and set the IsSelected property of the object to true.

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

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

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamDiagramContextMenuCase.zip
Reply Children
No Data