Skip to content
Morten Nielsen edited this page Mar 14, 2014 · 3 revisions

Set the Layers property to the collection of layers you want to show legend for. If you only want to display layers that are visible at the current scale range, also set the Scale property. Set this to 'NaN' (or don't set it) to avoid filtering by layer scale visibility. Both of these properties are available for binding directly from the map and the map view. Example:

  <esriTK:Legend Layers="{Binding Map.Layers, ElementName=MyMapView}" 
    Scale="{Binding Scale, ElementName=MyMapView}" />

Other useful properties:

  • ShowOnlyVisibleLayers - Don't show legend for layers not currently visible
  • ReverseLayersOrder - Reverses the layer order to easily order layers so that layers that are on top in the map is showing first in the legend. If you want more control over the order, use a converter or bind the collection via your view model to create a more custom collection.