Articles in this section
Category / Section

How to drilldown Map layers in WPF application?

1 min read

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

Conclusion

I hope you enjoyed learning about how to drilldown Map layers in WPF application.

You can refer to our WPF Map feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Map documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied