Version

Adding XamGeographicMap to a Page

Purpose

This topic provides information on how to add the XamGeographicMap™ control to an application page.

Required Background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic Purpose

This topic provides an overview of key features in the XamGeographicMap control.

In This Topic

This topic contains the following sections

Adding XamGeographicMap to a Page

Introduction

The XamGeographicMap control is designed to display geo-spatial data from shape files and geographic locations from view models on geographic imagery maps. However, this topic focuses on adding the XamGeographicMap control with the minimum code and property settings required for display. By default the XamGeographicMap control is displayed with geographic imagery tiles from Open Street Map service.

Preview

The following is a preview of the XamGeographicMap control with geographic imagery tiles from Open Street Map service.

GeographicMap Adding GeographicMap to Page 1.png

Requirements

The following table summarizes the requirements for adding the XamGeographicMap control.

Requirement Description

Prerequisites

To complete the procedure section of this topic, you need to create a WPF project.

Data

The XamGeographicMap control does not require any data for its rendering because it displays geographic imagery tiles from Open Street Map in its background content. However, the XamGeographicMap control can also display geo-spatial data from shape files and geographic locations from view models. Refer to the following topics for more information on how this is accomplished and for data requirements:

Overview

The following is a conceptual overview of the process:

  1. Reference Infragistics assemblies in your project

  2. Add Infragistics namespaces to your application’s view

  3. Add the Geographic Map control to your application’s view

  4. Verify the results

Steps

The following procedure takes you step-by-step toward adding the XamGeographicMap control to a page.

Reference Infragistics NuGet packages

Add the following Infragistics NuGet package to your application:

  • Infragistics.WPF.GeographicMap

For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

Add Infragistics namespaces to your application’s view.

In the application page, add the following namespace declarations:

In XAML:

xmlns:ig="http://schemas.infragistics.com/xaml"

In Visual Basic:

Imports Infragistics.Controls.Maps

In C#:

using Infragistics.Controls.Maps;

Add the Geographic Map control to your application’s view.

The following code demonstrates adding the XamGeographicMap control with the minimum code and property settings required for display:

In XAML:

<Grid x:Name="LayoutRoot">
    <ig:XamGeographicMap x:Name="GeoMap" />
</Grid>

In Visual Basic:

Dim geoMap As New XamGeographicMap()
Me.LayoutRoot.Children.Add(geoMap)

In C#:

var geoMap = new XamGeographicMap();
this.LayoutRoot.Children.Add(geoMap);

Verify the results.

Build and run your project to verify the result. If you have implemented the steps correctly, the displayed XamGeographicMap should look like the one in the Preview section above.

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides information on how to bind geographic imagery in the XamGeographicMap control.

This topic provides information on how to bind shape files with geo-spatial data to the XamGeographicMap control.

This topic provides information on how to bind a view model with geo-spatial data to the XamGeographicMap control

This topic provides information on how to navigate the map content of the XamGeographicMap control.

This topic provides an API overview of key classes and properties of the XamGeographicMap control and its components.