Skip to main content
A newer version of this page is available. .

LayerBase.DataLoaded Event

Occurs after the data has been loaded into a map layer.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v18.2.dll

Declaration

public event DataLoadedEventHandler DataLoaded

Event Data

The DataLoaded event's data class is DataLoadedEventArgs.

Remarks

Handle the DataLoaded event to ensure that the data is loaded completely into a map layer.

Example

This example shows how to visualize the progress of loading image tiles from the OpenStreetMap data provider using a progress bar.

To accomplish this task, handle the ImageLayer.RequestDataLoading event and specify how the progress bar should be updated using the UpdateProgressBar method. Then, handle the LayerBase.DataLoaded event to specify the final state of the progress bar when the data load is finished.

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

namespace TilesLoaded {
    public partial class Form1 : Form {
        int requestsCounter = 0;
        ImageLayer Layer { get { return (ImageLayer)mapControl1.Layers[0]; } }

        public Form1() {
            InitializeComponent();
            Layer.RequestDataLoading += Layer_RequestDataLoading;
            Layer.DataLoaded += Layer_DataLoaded;
        }

        void Layer_RequestDataLoading(object sender, EventArgs e) {
            requestsCounter++;
            UpdateProgressBar();
        }

        void Layer_DataLoaded(object sender, DataLoadedEventArgs e) {
            progressBar1.Value = 100;
            progressBar1.Visible = false;
            label1.Visible = false;
            requestsCounter = 0;
        }

        void UpdateProgressBar() {
            if (!progressBar1.Visible)
                progressBar1.Visible = true;
            if (!label1.Visible)
                label1.Visible = true;
            progressBar1.Value = (int)(100 * (requestsCounter - 1) / requestsCounter);
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataLoaded 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.

See Also