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
245
How to know wich element is cliked in xam Map ?
posted

HI ,

 

Im new to xam map until now i can add element to layers , How i know  wich element is cliked ?

thanks 

  • 2505
    Verified Answer
    Offline posted

    Hi bouhmid86,

    Please take a look at the following sample.

    XAML:
    <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="400"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
           
            <ListBox x:Name="lstClickedElement" Height="250" Width="400" Grid.Row="0"/>
           
            <igMap:XamMap x:Name="XamMap1" ElementClick="XamMap1_ElementClick" Grid.Row="1">
                <igMap:XamMap.Layers>
                    <igMap:MapLayer x:Name="europe" FillMode="RandomSelect">
                        <igMap:MapLayer.Reader>
                            <igMap:ShapeFileReader Uri="Shapefiles/europe/europe" DataMapping="Name=CNTRY_NAME; Caption=CNTRY_NAME; ToolTip=CURR_TYPE"/>
                        </igMap:MapLayer.Reader>
                    </igMap:MapLayer>
                </igMap:XamMap.Layers>
            </igMap:XamMap>
        </Grid>

    CB:
            private void XamMap1_ElementClick(object sender, MapElementClickEventArgs e)
            {
                this.lstClickedElement.Items.Add(String.Format("Clicked on {0}.", e.Element.Caption));
            }

    Hope that helps,
    Milana Zhileva