How to: Connect a Map Control to the Bing Geocode Service
This example demonstrates how to provide the capability for end-users to search an address associated with a specified location on a map and get detailed information about this place in the pushpin’s tooltip, utilizing the Bing Geocode web service. Do this as follows:.
- Create an InformationLayer object and add it to the MapControl.Layers collection.
- Create a
BingGeocodeDataProvider
object, specify its properties and assign it to the InformationLayer.DataProvider property.
using DevExpress.XtraMap;
using System.Windows.Forms;
namespace GeocodeProvider {
public partial class Form1 : Form {
const string bingKey = "YOUR BING KEY HERE";
InformationLayer GeocodeLayer {
get {
return (InformationLayer)mapControl1.Layers["GeocodeLayer"];
}
}
public Form1() {
InitializeComponent();
GeocodeLayer.DataProvider = new BingGeocodeDataProvider() {
BingKey = bingKey,
MaxVisibleResultCount = 1
};
}
}
}