<sdk:TabItem Header="Layers" Name="LayersTab" Margin="0,0,0,0">
<Grid>
<esri:Legend LayerItemsMode="Tree" x:Name="MyLegend" Map="{Binding ElementName=Map}"
LegendItemTemplate="{x:Null}" Refreshed="Legend_Refreshed"
LayerIDs="USAID_Layers" ShowOnlyVisibleLayers="false">
<esri:Legend.LayerTemplate>
<DataTemplate>
<!--Layer Item-->
<StackPanel x:Name="checkBoxName" Orientation="Horizontal">
<!-- Two overlapping checkboxes, the second checkbox is grayed when the layer is not visible-->
<Grid VerticalAlignment="Center">
<CheckBox IsChecked="{Binding IsEnabled, Mode=TwoWay}" />
<CheckBox IsChecked="{Binding IsEnabled}" IsEnabled="{Binding IsVisible}" IsHitTestVisible="False" />
</Grid>
<TextBlock Text="{Binding Label}" Tag="{Binding SubLayerID}" VerticalAlignment="Center" Margin="2,0,0,0" MouseLeftButtonDown="ClickOnLayerName" />
</StackPanel>
</DataTemplate>
</esri:Legend.LayerTemplate>
</esri:Legend>
</Grid>
</sdk:TabItem>
<sdk:TabItem Header="Legend" Name="LegendTab">
<Grid>
<esri:Legend Map="{Binding ElementName=Map}"
LayerItemsMode="Tree"
LayerIDs="USAID_Layers"
ShowOnlyVisibleLayers="True">
</esri:Legend>
</Grid>
</sdk:TabItem>
The feature layer is added but without the checkbox (only the name). Why?
My feature layer is a cluster layer. Its default legend looks like in the attached image.
Is it possible to show more detailed legend, not only the FlareClusterer?
You have to redefine the MapLayerTemplate as well as in this sample.
MapLayerTemplate is used for all main layers (Featurelayer, ArcGISDynamicMapServiceLayer, KmlLayer, .....)
The LayerTemplate is used for the sublayers of a main layer only.
If you associate a renderer to your feature layer (used when the graphics are not clustered), the legend should be the concatenation of the renderer and of the flareclusterer.