Back to Devexpress

InformationDataProviderBase.LayerItemsGenerating Event

windowsforms-devexpress-dot-xtramap-dot-informationdataproviderbase-412c8092.md

latest6.2 KB
Original Source

InformationDataProviderBase.LayerItemsGenerating Event

Occurs when a data provider starts generating map items for a layer.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public event LayerItemsGeneratingEventHandler LayerItemsGenerating
vb
Public Event LayerItemsGenerating As LayerItemsGeneratingEventHandler

Event Data

The LayerItemsGenerating event's data class is LayerItemsGeneratingEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancelledGets a value indicating whether an asynchronous operation has been canceled. Inherited from AsyncCompletedEventArgs.
ErrorGets a value indicating which error occurred during an asynchronous operation. Inherited from AsyncCompletedEventArgs.
ItemsReturns all the items generated for the layer.
UserStateGets the unique identifier for the asynchronous task. Inherited from AsyncCompletedEventArgs.

The event data class exposes the following methods:

MethodDescription
RaiseExceptionIfNecessary()Raises a user-supplied exception if an asynchronous operation failed. Inherited from AsyncCompletedEventArgs.

Example

csharp
void OnLayerItemsGenerating(object sender, LayerItemsGeneratingEventArgs e) {
    foreach(MapItem item in e.Items) {
        MapPolyline polyline = item as MapPolyline;
        if(polyline != null) {
            polyline.Stroke = Color.FromArgb(0xFF, 0x00, 0x72, 0xC6);
            polyline.StrokeWidth = 4;
        }
    }
}
vb
Private Sub OnLayerItemsGenerating(ByVal sender As Object, ByVal e As LayerItemsGeneratingEventArgs)
    For Each item As MapItem In e.Items
        Dim polyline As MapPolyline = TryCast(item, MapPolyline)
        If polyline IsNot Nothing Then
            polyline.Stroke = Color.FromArgb(&HFF, &H0, &H72, &HC6)
            polyline.StrokeWidth = 4
        End If
    Next item
End Sub

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

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#L32

csharp
geocodeProvider.LocationInformationReceived += OnLocationInformationReceived;
geocodeProvider.LayerItemsGenerating += OnLayerItemsGenerating;
informationLayer.DataProvider = geocodeProvider;

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

csharp
geocodeProvider.LocationInformationReceived += OnLocationInformationReceived;
geocodeProvider.LayerItemsGenerating += OnLayerItemsGenerating;
simpleButton1.Click += requestLocation_Click;

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

vb
AddHandler geocodeProvider.LocationInformationReceived, AddressOf OnLocationInformationReceived
AddHandler geocodeProvider.LayerItemsGenerating, AddressOf OnLayerItemsGenerating
informationLayer.DataProvider = geocodeProvider

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

vb
AddHandler Me.geocodeProvider.LocationInformationReceived, AddressOf OnLocationInformationReceived
AddHandler Me.geocodeProvider.LayerItemsGenerating, AddressOf OnLayerItemsGenerating
AddHandler Me.simpleButton1.Click, AddressOf requestLocation_Click

See Also

InformationDataProviderBase Class

InformationDataProviderBase Members

DevExpress.XtraMap Namespace