Skip to main content
All docs
V25.1
  • AzureSearchDataProvider Class

    Allows you to obtain geo data from the Azure Maps Search service.

    Namespace: DevExpress.Xpf.Map

    Assembly: DevExpress.Xpf.Map.v25.1.dll

    NuGet Package: DevExpress.Wpf.Map

    Declaration

    public class AzureSearchDataProvider :
        AzureMapDataProviderBase,
        ISearchPanelRequestSender

    Remarks

    AzureSearchDataProvider allows you to use the Azure Maps Search service. Assign such an object to the InformationLayer.DataProvider property to display the search panel and allow users to search for a specific place on a map. To hide the search panel, set the MapControl.ShowSearchPanel property to false.

    Call the AzureSearchDataProvider.Search method to search for locations that correspond to the specified attributes. The maxResults parameter of the Search method overloads allows you to specify the number of results that can be obtained by a search request.

    To get search results, handle the SearchCompleted event. The SearchCompletedEventArgs.RequestResult returns a SearchRequestResult object that stores search results.

    For more information on how to use search map services in the Map Control, refer to the following help topic: Search.

    Example

    The following example calls the AzureSearchDataProvider.Search method to search for a location by a text search query:

    DevExpress MapControl for WPF - A location found using AzureSearchProvider

    <Window xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map" 
        ...>
        <Window.Resources>
            <sys:String x:Key="azureKey">
                Your AzureMaps key here.
            </sys:String>
        </Window.Resources>
        <Grid>
            <dxm:MapControl Loaded="MapControl_Loaded" x:Name="mapControl" ToolTipEnabled="True" ShowSearchPanel="False">
                <dxm:ImageLayer>
                    <dxm:AzureMapDataProvider AzureKey="{StaticResource azureKey}" Tileset="BaseRoad"/>
                </dxm:ImageLayer>
                <dxm:InformationLayer x:Name="infoLayer">
                    <dxm:AzureSearchDataProvider x:Name="searchProvider" AzureKey="{StaticResource azureKey}" 
                                                 LayerItemsGenerating="OnLayerItemsGenerating"/>
    
                </dxm:InformationLayer>
            </dxm:MapControl>
        </Grid>
    </Window>
    
    using DevExpress.Xpf.Map;
    using System.Windows;
    
    namespace WpfMapExample {
        public partial class MainWindow : Window {
            public MainWindow() {
                InitializeComponent();
            }
            private void MapControl_Loaded(object sender, RoutedEventArgs e) {
                searchProvider.Search("Av. Gustave Eiffel", maxResults: 5);
            }
            private void OnLayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs args) {
                mapControl.ZoomToFit(args.Items, 0.8);
            }
        }
    }
    
    See Also