Control layers shown in Legend

557
2
Jump to solution
02-21-2013 10:24 AM
LuisGarcia2
Occasional Contributor II
I have a map and I attached a Legend object to it by using the binding element.

<esri:Legend Grid.Column="1" Name="legend1" Map="{Binding ElementName=map1}" LayerItemsMode="Tree" ShowOnlyVisibleLayers="False" FontSize="11">


That is all fine however there is a specific layer that we add at run time and we do not want that layer showing in the Legend. Is there a way to control what layers show at any given point?

Thanks!
0 Kudos
1 Solution

Accepted Solutions
LuisGarcia2
Occasional Contributor II
Never mind, I found it:

this.legend1.LayerItems.RemoveAt(myPosition);

View solution in original post

0 Kudos
2 Replies
LuisGarcia2
Occasional Contributor II
Never mind, I found it:

this.legend1.LayerItems.RemoveAt(myPosition);

View solution in original post

0 Kudos
DominiqueBroux
Esri Frequent Contributor
Alternatively, for the layers you don't want to see in the legend, you can set the flag ShowLegend to false.
0 Kudos