For more information about this data adapter, refer to the Load Vector Data from a KML File topic.

Example
To load shape data from a KML file do the following.
Program.cs |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WinForms_MapControl_KmlFileDataAdapter {
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
|
Form1.cs |
using DevExpress.XtraMap;
using System;
using System.Windows.Forms;
namespace WinForms_MapControl_KmlFileDataAdapter {
public partial class Form1 : Form {
const string filePath = "../../kmlFile.kml";
VectorItemsLayer KmlLayer { get { return (VectorItemsLayer)mapControl1.Layers["KmlLayer"]; } }
public Form1() {
InitializeComponent();
#region #KmlFileDataAdapter
Uri baseUri = new Uri(System.Reflection.Assembly.GetEntryAssembly().Location);
KmlLayer.Data = new KmlFileDataAdapter() {
FileUri = new Uri(baseUri, filePath)
};
#endregion #KmlFileDataAdapter
}
}
}
|
Program.vb |
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Imports System.Windows.Forms
Namespace WinForms_MapControl_KmlFileDataAdapter
Friend NotInheritable Class Program
Private Sub New()
End Sub
''' <summary>
''' The main entry point for the application.
''' </summary>
<STAThread> _
Shared Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New Form1())
End Sub
End Class
End Namespace
|
Form1.vb |
Imports DevExpress.XtraMap
Imports System
Imports System.Windows.Forms
Namespace WinForms_MapControl_KmlFileDataAdapter
Partial Public Class Form1
Inherits Form
Private Const filePath As String = "../../kmlFile.kml"
Private ReadOnly Property KmlLayer() As VectorItemsLayer
Get
Return CType(mapControl1.Layers("KmlLayer"), VectorItemsLayer)
End Get
End Property
Public Sub New()
InitializeComponent()
' #Region "#KmlFileDataAdapter"
' Create a KML file data adapter.
Dim baseUri As New Uri(System.Reflection.Assembly.GetEntryAssembly().Location)
KmlLayer.Data = New KmlFileDataAdapter() With {.FileUri = New Uri(baseUri, filePath)}
' #End Region ' #KmlFileDataAdapter
End Sub
End Class
End Namespace
|