Skip to main content

How to: Create a Custom Search Panel

This example demonstrates how to create a custom search panel.

  • Build a custom search panel. In this example, the panel contains two text edits (for the Location and Keywords) and the Search button. Also this panel allows customizing search provider properties.
  • To implement searching, create a InformationLayer object to the MapControl.Layers collection and assign a BingSearchDataProvider object to the InformationLayer.DataProvider property.
  • To search a location, the BingSearchDataProvider.Search method should be called. In this example, this method is called in the Search button click event handler.
NOTE

If you run the application, and see a window with the following error message: ”The specified Bing Maps key is invalid. To create a developer account, refer to http://www.microsoft.com/maps/developers”, refer to the following tutorial: How to: Get a Bing Maps Key.