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