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.
Unfortunately, activation email could not send to your email. Please try again.

How to drilldown map layers.

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

 

 

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
7648 04/07/2017 04/07/2017 WinRT SfMaps
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.