New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms Map

This tutorial will help you to quickly get started using the control.

In order to use RadMap in your project you have to add references to the following assemblies:

  • Telerik.WinControls
  • Telerik.WinControls.RadMap
  • Telerik.WinControls.UI

Follow the steps:

1. Create a new Windows Application project. 2. Drop a RadMap control on the form and set its Dock property to Fill. 3. The RadMap control doesn't display any imagery data initially, it needs an IMapProvider instance from which to consume this data. This example will use Bing Maps for its imagery source. To achieve that you have to add a new BingRestMapProvider to the RadMap.Providers property.

You must provide a Bing Maps Key to the provider for it to work. To get your free Bing Maps Key, please refer to the following link: Getting a Bing Maps Key.

If you use RadMap with .Net Framework 2.0 and you don't have an installation of the Telerik UI for WinForms suite on the current machine, it is necessary to add a reference to the Newtonsoft.Json assembly which can be found in the \Bin folder of the Telerik_UI_For_WinForms_[version] If you are using .Net Framework 4.0 this is not requried.

If you want to use data caching, you should set an IMapCacheProvider instance to the BingRestMapProvider.CacheProvider property. In this example a LocalFileCacheProvider will be used:

Using BingRestMapProvider

string cacheFolder = @"..\..\cache";
BingRestMapProvider bingProvider = new Telerik.WinControls.UI.BingRestMapProvider();
bingProvider.UseSession = true;
bingProvider.BingKey = bingKey;
LocalFileCacheProvider cache = new LocalFileCacheProvider(cacheFolder);
bingProvider.CacheProvider = cache;

Dim cacheFolder As String = "..\..\cache"
Dim bingProvider As BingRestMapProvider = New Telerik.WinControls.UI.BingRestMapProvider()
bingProvider.UseSession = True
bingProvider.BingKey = bingKey
Dim cache As New LocalFileCacheProvider(cacheFolder)
bingProvider.CacheProvider = cache

Figure 1: RadMap

WinForms RadMap Getting Started

See Also

Telerik UI for WinForms Learning Resources

In this article