This project has moved and is read-only. For the latest updates, please go here.

Folder withing Folder

Nov 26, 2011 at 1:46 PM

How to create Folder withing Folder? Folder class doesnt have any function as AddFolder.....

Nov 26, 2011 at 3:46 PM

Folder inherits from Container, which has an AddFeature method you can use (Container is an abstract base class that inherits from Feature). Here's a quick example:

Folder child = new Folder { Name = "Child Folder" };

Folder parent = new Folder { Name = "Parent" };
parent.AddFeature(child);

Which gives the following output:

<?xml version="1.0" encoding="utf-16"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Folder>
    <name>Parent</name>
    <Folder>
      <name>Child Folder</name>
    </Folder>
  </Folder>
</kml>