Back to Devexpress

InformationLayer.DataProvider Property

windowsforms-devexpress-dot-xtramap-dot-informationlayer.md

latest7.4 KB
Original Source

InformationLayer.DataProvider Property

Provides access to an object that obtains information data from online data providers.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(null)]
public InformationDataProviderBase DataProvider { get; set; }
vb
<DefaultValue(Nothing)>
Public Property DataProvider As InformationDataProviderBase

Property Value

TypeDefaultDescription
InformationDataProviderBasenull

An InformationDataProviderBase class descendant that is a specific data provider.

|

Remarks

For more information, refer to Map Image Data.

Example

This example demonstrates how to allow users to search for a specific place on a map using the Search panel.

To enable searching in the map control, do the following.

  • Create an InformationLayer and add it to the map.
  • Create an instance of the BingSearchDataProvider and assign it to the InformationLayer.DataProvider property.
  • Specify the Bing Maps key using the BingMapDataProvider.BingKey property.

The Search panel appears automatically (since the MapSearchPanelOptions.Visible property value is true by default).

csharp
using DevExpress.XtraMap;
using System.Windows.Forms;

namespace ConnectBingSearchProvider {
    public partial class Form1 : Form {
        const string bingKey = "YOUR BING KEY HERE";

        InformationLayer SearchLayer { 
            get {
                return (InformationLayer)mapControl1.Layers["SearchLayer"];
            }
        }

        public Form1() {
            InitializeComponent();

            BingSearchDataProvider searchProvider = new BingSearchDataProvider() { 
                BingKey = bingKey 
            };

            searchProvider.SearchOptions.ResultsCount = 5;

            SearchLayer.DataProvider = searchProvider;
        }      
    }
}
vb
Imports DevExpress.XtraMap
Imports System.Windows.Forms

Namespace ConnectBingSearchProvider
    Partial Public Class Form1
        Inherits Form

        Private Const bingKey As String = "YOUR BING KEY HERE"

        Private ReadOnly Property SearchLayer() As InformationLayer
            Get
                Return CType(mapControl1.Layers("SearchLayer"), InformationLayer)
            End Get
        End Property

        Public Sub New()
            InitializeComponent()

            Dim searchProvider As New BingSearchDataProvider() With {.BingKey = bingKey}

            searchProvider.SearchOptions.ResultsCount = 5

            SearchLayer.DataProvider = searchProvider
        End Sub
    End Class
End Namespace

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataProvider property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-map-get-geo-point-info-from-bing-geocode-service/CS/RequestLocationInformation/Form1.cs#L33

csharp
geocodeProvider.LayerItemsGenerating += OnLayerItemsGenerating;
informationLayer.DataProvider = geocodeProvider;
#endregion #CreateGeocodeProvider

winforms-map-execute-the-search-operation-for-multiple-locations/CS/GetSearchLocationAdditionalInfo/Form1.cs#L130

csharp
searchProvider = new BingSearchDataProvider();
infoLayer.DataProvider = searchProvider;
searchProvider.GenerateLayerItems = false;

winforms-map-use-openstreetmap-search-service/CS/OsmSearchSample/MainForm.cs#L22

csharp
osmSearchDataProvider.ResultsCount = 5;
infoLayer.DataProvider = osmSearchDataProvider;

map-for-winforms-azure-geocoding/CS/AzureGeocoding/Form1.cs#L36

csharp
simpleButton1.Click += requestLocation_Click;
informationLayer.DataProvider = geocodeProvider;
imageLayer.DataProvider = imageProvider;

winforms-map-get-geo-point-info-from-bing-geocode-service/VB/RequestLocationInformation/Form1.vb#L41

vb
AddHandler geocodeProvider.LayerItemsGenerating, AddressOf OnLayerItemsGenerating
            informationLayer.DataProvider = geocodeProvider
#End Region ' #CreateGeocodeProvider

winforms-map-execute-the-search-operation-for-multiple-locations/VB/GetSearchLocationAdditionalInfo/Form1.vb#L113

vb
searchProvider = New BingSearchDataProvider()
infoLayer.DataProvider = searchProvider
searchProvider.GenerateLayerItems = False

map-for-winforms-azure-routing/VB/Form1.vb#L32

vb
azureRoute = New AzureRouteDataProvider() With {.AzureKey = azureKey}
routeInfoLayer.DataProvider = azureRoute
itemData = New MapItemStorage()

map-for-winforms-azure-geocoding/VB/AzureGeocoding/Form1.vb#L42

vb
AddHandler Me.simpleButton1.Click, AddressOf requestLocation_Click
informationLayer.DataProvider = geocodeProvider
imageLayer.DataProvider = imageProvider

See Also

Map Image Data

InformationLayer Class

InformationLayer Members

DevExpress.XtraMap Namespace