<Border x:Name="AdministrativeTabBorder" Margin="5,0,5,0" Visibility="Collapsed" Grid.Column="0" Grid.Row="4" BorderBrush="#FFFFFFCC">
<ListBox x:Name="AdministrativeListBox" FontSize="12" Background="#FFFFFFCC" BorderBrush="#FFFFFFCC">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Margin="2" FontSize="9"
Name="AdministrativeCheckBox"
Content="{Binding Name}"
IsChecked="{Binding DefaultVisibility, Mode=TwoWay}"
Tag="{Binding ID}"
ClickMode="Press"
Click="AdministrativeCheckBox_Click"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
dynamicServiceLayer.SetLayerVisibility(21, true); dynamicServiceLayer.SetLayerVisibility(20, true);
<esri:Legend Map="{Binding ElementName=MyMap}" ShowOnlyVisibleLayers="False" LayerItemsMode="Flat"
LayerIDs="MyDynamicLayerID">
<esri:Legend.Template>
<ControlTemplate TargetType="esri:Legend">
<ListBox ItemsSource="{TemplateBinding LayerItemsSource}" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<ToolTipService.ToolTip>
<StackPanel MaxWidth="400">
<TextBlock FontWeight="Bold" Text="{Binding Layer.ID}" TextWrapping="Wrap" />
<TextBlock FontWeight="Bold" Text="{Binding Label}" TextWrapping="Wrap" />
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
<TextBlock Text="{Binding SubLayerID, StringFormat='SubLayer ID : {0}'}" />
<TextBlock Text="{Binding MinimumResolution, StringFormat='Minimum Resolution : {0:F6}'}" />
<TextBlock Text="{Binding MaximumResolution, StringFormat='Maximum Resolution : {0:F6}'}" />
</StackPanel>
</ToolTipService.ToolTip>
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
VerticalAlignment="Center">
</CheckBox>
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" VerticalAlignment="Center">
</CheckBox>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ControlTemplate>
</esri:Legend.Template>
</esri:Legend>
<esri:Legend Map="{Binding ElementName=MyMap}" ShowOnlyVisibleLayers="False" LayerItemsMode="Flat"
LayerIDs="Visible Layers" ScrollViewer.VerticalScrollBarVisibility="Visible">
void Legend_Refreshed(object sender, ESRI.ArcGIS.Client.Toolkit.Legend.RefreshedEventArgs e)
{
ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel[] layerIt = new ESRI.ArcGIS.Client.Toolkit.Primitives.LayerItemViewModel[34];
e.LayerItem.LayerItems.CopyTo(layerIt, 0);
e.LayerItem.LayerItems.Clear();
int[] layer_num = new int[20] { 15, 14, 7, 16, 18, 19, 31, 29, 30, 33, 23, 21, 20, 17, 10, 5, 32, 26, 7, 15 };
for (int i = 0; i < 20; i++)
e.LayerItem.LayerItems.Add(layerIt.ElementAt(layer_num));
}