
Visual Basic (Declaration) | |
---|---|
Public Class Legend Inherits System.Windows.Controls.Control |
C# | |
---|---|
public class Legend : System.Windows.Controls.Control |
Allowing the user to toggle map service layers on and off and change opacity by overriding the MapLayerTemplate:
<esri:Legend Map="{Binding ElementName=MyMap}" LayerItemsMode="Flat"
ShowOnlyVisibleLayers="False">
<esri:Legend.MapLayerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" >
</CheckBox>
<Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />
</StackPanel>
</DataTemplate>
</esri:Legend.MapLayerTemplate>
</esri:Legend>
Allowing the user to toggle sub layers in a dynamic map service by overriding the LayerTemplate:
<esri:Legend Map="{Binding ElementName=MyMap}" LayerItemsMode="Flat"
ShowOnlyVisibleLayers="False">
<esri:Legend.LayerTemplate>
<DataTemplate>
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" >
</CheckBox>
</DataTemplate>
</esri:Legend.LayerTemplate>
</esri:Legend>
System.Object
System.Windows.DependencyObject
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Control
ESRI.ArcGIS.Client.Toolkit.Legend
Target Platforms: Windows Vista, Windows 7