Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

WmsLayerCollection.Item[Int32] Property

Returns a WMS layer from the WmsLayerCollection stored under the specified index.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.2.dll

NuGet Package: DevExpress.Win.Map

#Declaration

public WmsLayer this[int index] { get; }

#Parameters

Name Type Description
index Int32

A Int32 object representing the index number.

#Property Value

Type Description
WmsLayer

A WmsLayer object.

#Example

This example demonstrates how to receive information from a Web Map Service using the WmsDataProvider.ResponseCapabilities event handler.

To do this, use the CapabilitiesRespondedEventArgs arguments of the event to specify a WMS active layer and obtain the required information.

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

namespace ResponseCapabilitiesHandler {
    public partial class Form1 : Form {
        ImageLayer WmsLayer {
            get { return (ImageLayer)mapControl.Layers["WmsImageLayer"]; }
        }
        WmsDataProvider Provider {
            get { return WmsLayer.DataProvider as WmsDataProvider; }
        }
        public Form1() {
            InitializeComponent();
        }
        private void Form1_Load(object sender, System.EventArgs e) {
            // Handle the ResponseCapabilities event.
            Provider.ResponseCapabilities += OnResponseCapabalities;
        }
        void OnResponseCapabalities(object sender, CapabilitiesRespondedEventArgs e) {
            // Specify an active layer for the map control.
            Provider.ActiveLayerName = e.Layers[0].Name;
            // Recieve information on the active layer.
            label1.Text = string.Format("Layer name: {0}, Layer title: {1}",  e.Layers[0].Name, e.Layers[0].Title);           
        }
    }
}
See Also