Hi Guys,
I was wondering if someone can help me out. I am trying to search for a certain layer using the ID property but my map contains many different types of Layers.
Here is a small diagram I have quickly made up to help explain what I am trying to do.
GroupLayerOne
ChildLayerOne
ChildLayerTwo
GroupLayerTwo
ChildGroupLayerOne
LayerOne
LayerTwo
LayerThree
ChildLayerThree
GraphicsLayer
I am trying to think of a easy way of searching through all these layers to find the one I want. I been toying around with trying to do it myself but I was wondering if the ESRI SDK had some functionailty that would make this easier.
Any advice/help appericated guys.
Thanks,
Chris
Solved! Go to Solution.
You can use EnumerateAllLayers or EnumerateLeaves defined on FeatureCollection.
Something like:
foreach(var layer in MyMapView.Map.Layers.EnumerateLeaves())
.....
You can use EnumerateAllLayers or EnumerateLeaves defined on FeatureCollection.
Something like:
foreach(var layer in MyMapView.Map.Layers.EnumerateLeaves())
.....
Thanks for the reply Dom,
For some reason I cannot access this function via the Layers property.
Its a function thats part of the GroupLayerBase class.
I have tried something like this:
var trees = GroupLayerBase.EnumerateLeaves(_map.Layers);
But the tree variable has null layers after its called this.
Scratch that last comment Dom,
It seems to be working as it should.
Thanks!!!