We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to drilldown map layers.

Platform: WinRT |
Control: SfMaps |
Published Date: April 7, 2017 |
Last Revised Date: April 7, 2017

MapLayers can be drilldown by using the following steps,

Step1: Create a Maps Sample and include the necessary script files

Step2: Maps enable drilldown by clicking on the map region.When Shape gets Selected, Using BaseMapIndex the initial layer loaded in map.

XAML

 <maps:SfMap EnableZoom="False" EnablePan="False" x:Name="map" ShowCoords="False">

 <maps:SfMap.Layers>

<maps:ShapeFileLayer MapPopupVisibility="Collapsed" Background="#FFF4F4F4"

ItemsSource="{Binding Models}" ShapeIDPath="Continent" ShapeIDTableField="Continent"

EnableSelection="True" Uri="SalesAnalysisDemo.ShapeFile.continent.shp" >

<maps:ShapeFileLayer.ItemsTemplate> <DataTemplate>

<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False" >

                <TextBlock HorizontalAlignment="Center" Foreground="#FF333333" Text="{Binding Data.Continent}"/>

                <TextBlock HorizontalAlignment="Center" Foreground="#FF333333" Text="{Binding Data.DisplaySalesValue}"/>

                                </StackPanel>

                            </DataTemplate>

                        </maps:ShapeFileLayer.ItemsTemplate>

                    </maps:ShapeFileLayer>

  <maps:ShapeFileLayer MapItemsVisibility="Collapsed" ShapeIDPath="Country"

MapPopupVisibility="Visible" Background="#FFF4F4F4" ShapeIDTableField="Country"

PopupCustomTemplate="{StaticResource PopupKey}" ItemsSource="{Binding SalesByCountry}"

Uri="SalesAnalysisDemo.ShapeFile.Oceania.shp">

</maps:ShapeFileLayer>

C#

void Maps_ShapesSelected(object sender, SelectionEventArgs args)

        {

            SalesByContinet salesByContinent = ((args.Items as ObservableCollection<MapShape>)[0].DataContext as SalesByContinet);

            if (salesByContinent != null)

            {

                if (salesByContinent.Continent == "Africa")

                {

                    this.map.BaseMapIndex = 6;

                }

                else if (salesByContinent.Continent == "Oceania")

                {

                    this.map.BaseMapIndex = 1;

                }

          }

      }

The following screenshot shows the drilldown of maplayers

 

 

 

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon