You are viewing help content for pre-release software. This document and the features it describes are subject to change. Switch to the current version.

SvgFileDataAdapter Class

A data adapter that loads data from SVG files, and displays it on vector layers.

Namespace: DevExpress.Xpf.Map

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


public class SvgFileDataAdapter :


SVG is a two-dimensional vector graphic format that uses an XML-based text format to describe images.

The image below shows a vector map loaded from an SVG file.

Map Control with data from SVG file

The following table lists supported SVG elements and related map items:

SVG element

Map item







(M,m,L,l,H,h,V,v,Z,z commands are supported)









The Map Control does not support the style element and style tag in the SVG markup.

Load Data

Follow the steps below to load data from an SVG file:

View Example

        <dxm:SvgFileDataAdapter FileUri="Data/countries.svg" />

Access and Customize Map Items

When vector items are loaded, the MapGeoDataAdapter.ShapesLoaded event occurs. Use the e.Shapes property to access loaded shapes.

     <dxm:SvgFileDataAdapter FileUri="Data/countries.svg" ShapesLoaded="SvgFileDataAdapter_ShapesLoaded" />
private void SvgFileDataAdapter_ShapesLoaded(object sender, DevExpress.Xpf.Map.ShapesLoadedEventArgs e) {
  foreach (MapPath item in e.Shapes) {
      item.Fill = Brushes.Gray;

Use the MapControl.ZoomToFitLayerItems method to zoom a map to fit layer items.

<dxm:MapControl x:Name="mapControl">
 <dxm:VectorLayer x:Name="vectorLayer" DataLoaded="VectorLayer_DataLoaded" >
     <dxm:SvgFileDataAdapter FileUri="Data/countries.svg" />
 private void VectorLayer_DataLoaded(object sender, DataLoadedEventArgs e) {
  mapControl.ZoomToFitLayerItems(new LayerBase[] { vectorLayer });

You can change shape colors based on shape data. Refer to the following help topic for more information: Colorizers.

You can also group items of the same type. To do this, initialize the MapDataAdapterBase.Clusterer property with a clusterer.

See Also