Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AzureSearchDataProvider.Search(AzureAddress, Int32) Method

Searches for locations that correspond to the specified address.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.2.dll

NuGet Package: DevExpress.Win.Map

#Declaration

public void Search(
    AzureAddress address,
    int maxResults = 5
)

#Parameters

Name Type Description
address AzureAddress

The address.

#Optional Parameters

Name Type Default Description
maxResults Int32 5

The number of results that can be obtained by a search request.

#Remarks

The following code snippet searches for the locations that correspond to the specified AzureAddress:

using DevExpress.XtraMap;
// ...
const string azureKey =  "your key";
//...
AzureSearchDataProvider azureSearchProvider = new AzureSearchDataProvider() {
  AzureKey = azureKey,
};
// Specify the address info.
azureSearchProvider.Search(new AzureAddress() {
    AddressLine = "15127 NE 24th St",
    CountryRegion = "United States",
    AdminDistricts = new string[,] { { "WA" } , {"King County"} }, 
    Locality = "Redmond",
    PostalCode = "98052"
}, 5);
// Create a layer.
InformationLayer informationLayer = new InformationLayer();
informationLayer.DataProvider = azureSearchProvider;
// Zoom the map to fit the rearch result.
informationLayer.DataRequestCompleted += OnDataRequestCompleted;
void OnDataRequestCompleted(object sender, RequestCompletedEventArgs e) {
    map.ZoomToFitLayerItems(0.4);
}
// Add the created layers to the collection.
map.Layers.Add(informationLayer);
See Also