Back to Devexpress

How to: Load Data from a SVG File

windowsforms-115013-controls-and-libraries-map-control-examples-vector-data-providing-data-how-to-load-data-from-a-svg-file.md

latest1.3 KB
Original Source

How to: Load Data from a SVG File

  • Nov 13, 2018

To load SVG file content to the Map Control, create a new SvgFileDataAdapter and assign it to the VectorItemsLayer.Data property. Then, specify the SvgFileDataAdapter.FileUri property of the adapter.

View Example

csharp
private void Form1_Load(object sender, EventArgs e) {
    Uri baseUri = new Uri(System.Reflection.Assembly.GetExecutingAssembly().Location);
    map.Layers.Add(new VectorItemsLayer {
        Data = new SvgFileDataAdapter {
            FileUri = new Uri(baseUri, "..\\..\\Data\\countries.svg")
        }
    });
}
vb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    Dim baseUri As New Uri(System.Reflection.Assembly.GetExecutingAssembly().Location)
    map.Layers.Add(New VectorItemsLayer With { _
        .Data = New SvgFileDataAdapter With {.FileUri = New Uri(baseUri, "..\..\Data\countries.svg")} _
    })
End Sub