Back to Devexpress

WmsDataProvider.ResponseCapabilities Event

wpf-devexpress-dot-xpf-dot-map-dot-wmsdataprovider-395f3e69.md

latest4.1 KB
Original Source

WmsDataProvider.ResponseCapabilities Event

Occurs when a Map control retrieves capabilities which the map service provides.

Namespace : DevExpress.Xpf.Map

Assembly : DevExpress.Xpf.Map.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public event CapabilitiesRespondedEventHandler ResponseCapabilities
vb
Public Event ResponseCapabilities As CapabilitiesRespondedEventHandler

Event Data

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

PropertyDescription
ExceptionGets a thrown exception.
LayersReturns a collection of available layers supported by a Web Map Service.

Example

This example demonstrates how to obtain a collection of layers supported by the Web Map Service.

To do this, use the WmsDataProvider.ResponseCapabilities event arguments to obtain the CapabilitiesRespondedEventArgs.Layers collection.

xaml
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
    xmlns:Properties="clr-namespace:WpfWmsExample.Properties"
    x:Class="WpfWmsExample.MainWindow"
    Title="MainWindow" Height="360" Width="640">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <dxm:MapControl Grid.Column="0"
            IsManipulationEnabled="False">
            <dxm:ImageLayer>
                <dxm:WmsDataProvider x:Name="Provider" 
                    ServerUri="http://Your_Server_URI" 
                    ActiveLayerName="{Binding ElementName=listBox, Path=SelectedItem.Name}"
                    ResponseCapabilities="OnResponseCapabilities"/>
            </dxm:ImageLayer>
        </dxm:MapControl>
        <StackPanel Grid.Column="1">
            <TextBlock Text="Available layers:"/>
            <ListBox x:Name="listBox"
                SelectedIndex="0"
                Background="AliceBlue" 
                DisplayMemberPath="Name" 
                Height="311"/>
        </StackPanel>
    </Grid>
</Window>
vb
Imports System.Windows
Imports DevExpress.Xpf.Map

Namespace WpfWmsExample
    ''' <summary>
    ''' Interaction logic for MainWindow.xaml
    ''' </summary>
    Partial Public Class MainWindow
        Inherits Window

        Public Sub New()
            InitializeComponent()
        End Sub
        Private Sub OnResponseCapabilities(ByVal sender As Object, ByVal e As CapabilitiesRespondedEventArgs)
            listBox.ItemsSource = e.Layers
        End Sub
    End Class
End Namespace
csharp
using System.Windows;
using DevExpress.Xpf.Map;

namespace WpfWmsExample {
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
        }
        private void OnResponseCapabilities(object sender, CapabilitiesRespondedEventArgs e) {
            listBox.ItemsSource = e.Layers;
        }
    }
}

See Also

WmsDataProvider Class

WmsDataProvider Members

DevExpress.Xpf.Map Namespace