Context Menu on Polygon

2 posts, 0 answers
  1. Amit
    Amit avatar
    1 posts
    Member since:
    Aug 2015

    Posted 06 Aug 2015 Link to this post

    Hi,

    I ​have loaded multiple polygons from SQL on a bing map and have a context menu for the polygons on the information layer.

    However, I cant find any way to bind and get the unique id of the clicked polygon.

    <telerik:InformationLayer x:Name="infoLayer" >
                    <telerik:InformationLayer.Reader>
                        <telerik:SqlGeospatialDataReader Source="{Binding SpatialData}" x:Name="Data"
                                                         GeospatialPropertyName="Polygon"
                                                         ToolTipTemplate="{StaticResource ToolTipDataTemplate}"
                                                         />
                    </telerik:InformationLayer.Reader>
                    <telerik:InformationLayer.ContextMenu>
                        <ContextMenu x:Name="PolygonMenu">
                            <MenuItem Header="Menu Item 1" Command="{Binding Path=PolygonSelectedCommand}"
                                      CommandParameter="{Binding ElementName=infoLayer,Path=????}"/>
                        </ContextMenu>
                    </telerik:InformationLayer.ContextMenu>
                     
                    <telerik:InformationLayer.ShapeFill>
                        <telerik:MapShapeFill Fill="Transparent"  Stroke="Red" StrokeThickness="1" />
                    </telerik:InformationLayer.ShapeFill>
                    <telerik:InformationLayer.HighlightFill>
                        <telerik:MapShapeFill Fill="#b2FFFFFF"  Stroke="Red" StrokeThickness="1" />
                    </telerik:InformationLayer.HighlightFill>
                </telerik:InformationLayer>

    Thanks,

  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 11 Aug 2015 Link to this post

    Hi Amit,

    Since RadMap shapes like MapPolyline, MapPolygon and etc. does not support context menu out-of-the-box I highly recommend that you use the approach my colleague Andrey demonstrated in this forum post. (as you will see we add the context menu to the RadMap itself and not the Information Layer). I believe that you would be able to find the clicked polygon from MenuItemClicked event args.

    Regards,
    Evgenia
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top