How to: Load Vector Data from a KML File
To load vector data from a KML file, do the following.
- Create a VectorFileLayer object and add it to the MapControl.Layers collection.
- Create an instance of the KmlReader class and assign the instance to the VectorFileLayer.FileReader property.
- Create a MapFileSourceBase class descendant object, configure it and assign it to the MapFileReaderBase.FileSource property of the instance.
<Map:VectorFileLayer
ShapeStroke="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Map:KmlReader>
<Map:KmlReader.FileSource>
<Map:MapPackageFileSource
FileName="Assets\States.kml"/>
</Map:KmlReader.FileSource>
</Map:KmlReader>
</Map:VectorFileLayer>