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

MapControl.CacheOptions Property

Gets or sets the settings for a map’s cache.

Namespace: DevExpress.Xpf.Map

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

Declaration

public CacheOptions CacheOptions { get; set; }

Property Value

Type Description
CacheOptions

A CacheOptions object.

Example

This example illustrates what actions should be executed to customize the local cache of a map control.

The local cache allows you to save internet resources and significantly increases map performance by loading saved map tiles from the local directory.

To enable the map cache, it is necessary to assign the MapControl.CacheOptions property to the CacheOptions object and specify the directory to which the loaded map tiles will be saved using the CacheOptions.Directory property. It is also necessary to specify the time interval after which map tile images will be updated from a map data provider via the CacheOptions.KeepInterval property.

In this example tile images of a map are loaded from the openstreetmap.org resource.

<Window x:Class="MapCacheOptions.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>
            <dxm:MapControl.CacheOptions>
                <dxm:CacheOptions Directory="C://MapTiles" KeepInterval="01:00:00"/>
            </dxm:MapControl.CacheOptions>
            <dxm:ImageTilesLayer >
                <dxm:ImageTilesLayer.DataProvider>
                    <dxm:OpenStreetMapDataProvider Kind="Road" />
                </dxm:ImageTilesLayer.DataProvider>
            </dxm:ImageTilesLayer>
        </dxm:MapControl>
    </Grid>
</Window>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CacheOptions property.

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