private void ProcessKmlLayer()
{
// Must be a group layer (KmlLayer inherits from GroupLayer)
if (!(Layer is GroupLayer))
return;
// Must have only one child
LayerCollection layers = (Layer as GroupLayer).ChildLayers;
if (layers == null || layers.Count() != 1)
return;
// The child must not be a KMLLayer i.e. not a group layer (sub folder and sub document must not be removed from the legend)
Layer childLayer = layers.FirstOrDefault();
if (childLayer is GroupLayer)
return;
// The layer must be a KmlLayer
if (!IsKmlLayer())
return;
// Set the child as transparent
LayerItemViewModel childLayerItem = LayerItems == null ? null : LayerItems.FirstOrDefault();
if (childLayerItem != null)
childLayerItem.IsTransparent = true;
}