windowsforms-devexpress-dot-xtramap-dot-informationlayer-d6c3b044.md
Specifies the data storage for the information layer.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
public MapItemStorage Data { get; }
Public ReadOnly Property Data As MapItemStorage
| Type | Description |
|---|---|
| MapItemStorage |
A MapItemStorage object.
|
To manually generate map items for received GIS data, do the following.
Set the InformationDataProviderBase.GenerateLayerItems property to false.
Handle the Geocode data received event of the Bing geocode data provider (BingGeocodeDataProvider.LocationInformationReceived).
In the event handler, implement map item generation based on information stored in the GeocodeRequestResult.Locations array of LocationInformation objects.
using DevExpress.XtraMap;
using System.Windows.Forms;
namespace WinForms_MapControl_InformationLayer {
public partial class Form1 : Form {
InformationLayer GeocodeLayer { get { return (InformationLayer)mapControl1.Layers["GeocodeLayer"]; } }
BingGeocodeDataProvider GeocodeProvider { get { return (BingGeocodeDataProvider)GeocodeLayer.DataProvider; } }
public Form1() {
InitializeComponent();
GeocodeProvider.LocationInformationReceived += GeocodeProvider_LocationInformationReceived;
}
void GeocodeProvider_LocationInformationReceived(object sender, LocationInformationReceivedEventArgs e) {
if ((e.Cancelled) && (e.Result.ResultCode != RequestResultCode.Success)) return;
GeocodeLayer.Data.Items.Clear();
foreach (LocationInformation locationInformation in e.Result.Locations)
GeocodeLayer.Data.Items.Add(new MapCallout() {
Location = locationInformation.Location,
Text = locationInformation.DisplayName
});
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WinForms_MapControl_InformationLayer {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Imports System.Windows.Forms
Namespace WinForms_MapControl_InformationLayer
Friend NotInheritable Class Program
Private Sub New()
End Sub
''' <summary>
''' The main entry point for the application.
''' </summary>
<STAThread> _
Shared Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New Form1())
End Sub
End Class
End Namespace
Imports DevExpress.XtraMap
Imports System.Windows.Forms
Namespace WinForms_MapControl_InformationLayer
Partial Public Class Form1
Inherits Form
Private ReadOnly Property GeocodeLayer() As InformationLayer
Get
Return CType(mapControl1.Layers("GeocodeLayer"), InformationLayer)
End Get
End Property
Private ReadOnly Property GeocodeProvider() As BingGeocodeDataProvider
Get
Return CType(GeocodeLayer.DataProvider, BingGeocodeDataProvider)
End Get
End Property
Public Sub New()
InitializeComponent()
AddHandler GeocodeProvider.LocationInformationReceived, AddressOf GeocodeProvider_LocationInformationReceived
End Sub
Private Sub GeocodeProvider_LocationInformationReceived(ByVal sender As Object, ByVal e As LocationInformationReceivedEventArgs)
If (e.Cancelled) AndAlso (e.Result.ResultCode <> RequestResultCode.Success) Then
Return
End If
GeocodeLayer.Data.Items.Clear()
For Each locationInformation As LocationInformation In e.Result.Locations
GeocodeLayer.Data.Items.Add(New MapCallout() With {.Location = locationInformation.Location, .Text = locationInformation.DisplayName})
Next locationInformation
End Sub
End Class
End Namespace
See Also