Skip to main content

How to: Create a Custom Search Panel

  • 2 minutes to read

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:

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.

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.
  • 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.

View Example

    <dxm:InformationLayer.DataProvider>
        <dxm:BingSearchDataProvider x:Name="searchProvider" 
                                    ShowSearchPanel="False"
                                    BingKey="{Binding Source={StaticResource bingKey}}"
                                    SearchCompleted="searchProvider_SearchCompleted">
            <dxm:BingSearchDataProvider.SearchOptions>
                <dxm:BingSearchOptions x:Name="options"
                                       AutocorrectQuery="{Binding ElementName=cbAutocorrect, Path=IsChecked}"
                                       DistanceUnit="{Binding ElementName=lbDistanceUnits, Path=SelectedValue}"
                                       ResultsCount="{Binding ElementName=tbCount, Path=Value}">
                </dxm:BingSearchOptions>
            </dxm:BingSearchDataProvider.SearchOptions>
        </dxm:BingSearchDataProvider>
    </dxm:InformationLayer.DataProvider>
<Button Grid.Row="2" Margin="4" Click="bSearch_Click">Search</Button>
Private Sub bSearch_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    tbSearchResult.Text = ""
    searchProvider.Search(tbLocation.Text)
End Sub
See Also