This is a migrated thread and some comments may be shown as answers.

Context Menu on Polygon

1 Answer 165 Views
Map
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 07 Aug 2015, 12:39 AM

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,

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 11 Aug 2015, 12:39 PM
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
Tags
Map
Asked by
Amit
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or