How to: Connect a Map Control to the Bing Search Service
- 2 minutes to read
This example demonstrates how to allow users to search for a specific place on a map using the Search panel.
Important
On May 21, 2024, Microsoft announced that Bing Maps for Enterprise and its API will be discontinued. Azure Maps will be a single unified enterprise mapping platform available from Microsoft.
To obtain and display map data from Azure Maps, we implemented the following providers:
- AzureMapDataProvider
- AzureSearchDataProvider
- AzureRouteDataProvider
- AzureGeocodeDataProvider
- AzureTrafficIncidentDataProvider
- AzureRouteIsochroneDataProvider
For information on how to migrate your app from Bing Maps to Azure Maps, see the following help topic: DevExpress Map Control for WPF: Migrate from Bing Maps to Azure Maps.
If you already have a Bing Maps for Enterprise license, you can keep using the current API. You must transition to the new API by June 30, 2025 (for free/basic licenses) or June 30, 2028 (for enterprise licenses). New licenses will no longer be available after June 30, 2025. Bing Maps will not work with our map controls without a license after that date.
To enable searching in the map control, do the following.
- Create an InformationLayer and add it to the MapControl.Layers collection.
- Create an instance of the
BingSearchDataProvider
and assign it to the InformationLayer.DataProvider property. - Specify the Bing Maps key using the BingMapDataProviderBase.BingKey property.
The Search panel appears automatically (since the MapControl.ShowSearchPanel property value is true by default).
<dxm:InformationLayer.DataProvider>
<dxm:BingSearchDataProvider BingKey="{Binding Source={StaticResource YourBingKey}}">
<dxm:BingSearchDataProvider.SearchOptions>
<dxm:BingSearchOptions ResultsCount="5" />
</dxm:BingSearchDataProvider.SearchOptions>
</dxm:BingSearchDataProvider>
</dxm:InformationLayer.DataProvider>