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

How to: Customize a Web Request for a Map Web Service

  • 2 minutes to read

This example shows how you can implement a custom proxy to make a request for map tiles from the Bing Maps web service.

To customize a web request, handle the MapImageDataProviderBase.WebRequest event. Then, use the web request arguments to specify your custom map request settings (e.g., custom MapWebRequestEventArgs.Credentials, MapWebRequestEventArgs.Headers for a proxy, etc.) to the Bing Maps data provider.

<Window 
    x:Class="WebRequest.MainWindow"
        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"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <dxm:MapControl Name="mapControl1" >
            <dxm:ImageTilesLayer x:Name="imageTilesLayer">
                <dxm:ImageTilesLayer.DataProvider>
                    <dxm:BingMapDataProvider BingKey="INSERT_YOUR_BING_KEY_HERE"   
                                             WebRequest="BingMapDataProvider_WebRequest"/>
                </dxm:ImageTilesLayer.DataProvider>
            </dxm:ImageTilesLayer>
            <dxm:VectorLayer>
                <dxm:MapDot Location="54.196353,37.611622" Size="10"/>
            </dxm:VectorLayer>
        </dxm:MapControl>
    </Grid>
</Window>
See Also