Hello,
My customer really like right clicks and wants to put context menus everywhere...
I use the XamMap control to load a map of Europe. I currently draw some MapElements and use the ValueTemplate to display a custom template. In that template I am able to add a context menu, so the user can make a right click on an element and open a context menu to interact with the element.
I would like to make the same thing with a country in the map. Technically I would like to add a context menu to the SurfaceElement generated by the XamlMap control for every country.
Do you have any ideas how to achieved that requirement ?
Thanks.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Thank you for the reply.
That could be a solution but you need to right click on the textblock (not on the surface itself) in order to show the context menu.
I used the ContextMenu property of the XamMap itself with a custom ContextMenu control. The ContextMenu is hidden if the MapElement clicked is not one of the surface elements (country) where we want to show the menu.
<ig:XamMap.ContextMenu> <custom:ContextMenu> <custom:MenuItem Header="Edit" Command="{Binding EditZoneItemCommand, Source={StaticResource viewModel}}" CommandParameter="{Binding Path=Value, Source={StaticResource ZoneValueRelay}}"> </custom:MenuItem> </custom:ContextMenu> </ig:XamMap.ContextMenu>
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.