Skip to main content

BingSearchCompletedEventHandler Delegate

A method that will handle the BingSearchDataProvider.SearchCompleted event.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v23.1.dll

NuGet Package: DevExpress.Win.Map


public delegate void BingSearchCompletedEventHandler(
    object sender,
    BingSearchCompletedEventArgs e


Name Type Description
sender Object

The event source.

e BingSearchCompletedEventArgs

A BingSearchCompletedEventArgs object that contains event data.


When creating a BingSearchCompletedEventHandler delegate, you identify the method that will handle the corresponding event. To associate an event with your event handler, add a delegate instance to this event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event handler delegates, see Events and Delegates in MSDN.


To manually generate map items for received GIS data, do the following.

View Example

using DevExpress.XtraEditors;
using DevExpress.XtraMap;
using System;
using System.Text;

namespace MapControl_SearchProcessing {
    public partial class Form1 : XtraForm {

        string BingKey { get { return "YourBingKey"; } }

        public Form1() {
            SearchProvider.SearchCompleted += OnSearchCompleted;
            SearchLayer.DataRequestCompleted += OnDataRequestCompleted;
            BingMapDataProvider.BingKey = BingKey;
            SearchProvider.BingKey = BingKey;

        private void btnSearch_Click(object sender, EventArgs e) {

        #region #SearchResultProcessing
        void OnSearchCompleted(object sender, BingSearchCompletedEventArgs e) {
            if(e.Cancelled) return;
            if(e.RequestResult.ResultCode != RequestResultCode.Success) {
                meResult.Text = "The Bing Search service does not work for this location.";

            StringBuilder resultList = new StringBuilder("");
            int resCounter = 1;
            foreach(BingLocationInformation resultInfo in e.RequestResult.SearchResults) {
                resultList.Append(String.Format("Result {0}:  \r\n", resCounter));
                resultList.Append(String.Format("Name: {0}\r\n", resultInfo.DisplayName));              
                resultList.Append(String.Format("Address: {0}\r\n", resultInfo.Address.FormattedAddress));
                resultList.Append(String.Format("Confidence level: {0}\r\n", resultInfo.Confidence));
                resultList.Append(String.Format("Geographic coordinates:  {0}\r\n", resultInfo.Location));
                resultList.Append(String.Format("Match code: {0}\r\n", resultInfo.MatchCode));
            meResult.Text = resultList.ToString();
        #endregion #SearchResultProcessing

        void OnDataRequestCompleted(object sender, RequestCompletedEventArgs e) {
See Also