Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Collapse]Map Control
   [Expand]Getting Started
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Collapse]GIS Data
     Search
     Geocode
     Routing
     Elevation
   [Expand]Vector Data
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]End-User Features
   [Expand]Product Information
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Search

The Map control supports the Microsoft’s Bing Search and the OpenStreetMap Search services, allowing you to embed a search functionality in your application. When this feature is enabled, you can type search criterion in the Search Panel (or use a custom UI), implement a request, and view the results in both the map and the search panel.

The BingSearchDataProvider and OsmSearchDataProvider classes represent the Bing Search and OpenStreetMap Search data providers which provide the search functionality. The sections below explain how to use a Search Data Provider in the Map control.

Important

Due to Bing canceling the SOAP service on July 30, 2017, the Map Control's Bing Search provider does not work correctly in version 16.1 and earlier.

Expanded Enabling Search

Do the following to enable search in the Map control:

The code snippet below shows how to do this.

You can also customize the search result count:

When the Map Control contains an Information Layer that provides Search data, the Map control automatically invokes its built-in search panel (the MapControl.ShowSearchPanel is set to true by default). Refer to the Search Panel topic to learn more about the built-in Search panel.

Expanded Using a Custom UI

The Map control provides a search functionality with additional parameters like a country region or postal code. Using this approach, you can build a custom search panel to get additional search results from the Search services.

Note

Set the MapControl.ShowSearchPanel property to false to disable the default Search panel when using this approach.

To start searching for a location, call the BingSearchDataProvider.Search or OsmSearchDataProvider.Search method.

For example, an Application's UI contains a text box named "tbKeywords" and a button named "btnSearch". To start a search, click the Search button which calls the following Search method overload:

Expanded Search Results

To get the search results, handle the BingSearchDataProvider.SearchCompleted or OsmSearchDataProvider.SearchCompleted event.

The SearchCompleted event handler arguments’ DevExpress.XtraMap.BingSearchCompletedEventArgs.RequestResult provides the SearchRequestResult descendant class instance to store Search results.

The results contain a display name, address, and the geographic coordinates (latitude and longitude) associated with the search location.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T188838.

The search results for the "New York" keywords are shown in the image below.

Expanded See Also

How would you rate this topic?​​​​​​​