<esri:Legend Map="{Binding ElementName=map}" Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ShowOnlyVisibleLayers="True" x:Name="CustomLegend" Refreshed="CustomLegend_Refreshed" > <esri:Legend.MapLayerTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <sdk:Label Content="{Binding Description}"/> <!--<Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />--> </StackPanel> </DataTemplate> </esri:Legend.MapLayerTemplate> <esri:Legend.LegendItemTemplate> <DataTemplate > <StackPanel Orientation="Horizontal"> <Image Source="{Binding ImageSource}"></Image> <sdk:Label Content="{Binding Label}" MinWidth="50"/> <sdk:Label Content="{Binding Tag}"/> </StackPanel> </DataTemplate> </esri:Legend.LegendItemTemplate> <esri:Legend.LayerTemplate> <DataTemplate> <CheckBox Content="{Binding Label}" IsChecked="{Binding IsEnabled, Mode=TwoWay}" IsEnabled="{Binding IsInScaleRange}" > </CheckBox> </DataTemplate> </esri:Legend.LayerTemplate> </esri:Legend>
I have a Legend which shows a disabled scrollbar even if the content is limited within the panel.
.
The default legend template uses a TreeView which has a built-in scrollviewer.
But this scrollviewer should not be visible if not needed.
Look at this sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#LegendSimple The scrollbars are only visible when needed.
If, for any reason, you need to change the default behavior, you can restyle the legend control (using EditTemplate functionalty in Blend) and use any other container to replace the treeview.
<Grid x:Name="panelCustomLegend" HorizontalAlignment="Right" Margin="0,50,80,0" VerticalAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Hidden" Visibility="Visible" Background="Black" > <Grid.RowDefinitions> <RowDefinition Height="20"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <sdk:Label Name="lblCustomLegend" Foreground="White" Grid.Row="0" MinWidth="50" MaxWidth="200" HorizontalAlignment="Center" FontSize="12" /> <esri:Legend Map="{Binding ElementName=map}" Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ShowOnlyVisibleLayers="True" x:Name="CustomLegend" Refreshed="CustomLegend_Refreshed" > <esri:Legend.MapLayerTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <sdk:Label Content="{Binding Description}"/> <!--<Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />--> </StackPanel> </DataTemplate> </esri:Legend.MapLayerTemplate> <esri:Legend.LegendItemTemplate> <DataTemplate > <StackPanel Orientation="Horizontal"> <Image Source="{Binding ImageSource}"></Image> <sdk:Label Content="{Binding Label}" MinWidth="50"/> <sdk:Label Content="{Binding Tag}"/> </StackPanel> </DataTemplate> </esri:Legend.LegendItemTemplate> <esri:Legend.LayerTemplate> <DataTemplate> <CheckBox Content="{Binding Label}" IsChecked="{Binding IsEnabled, Mode=TwoWay}" IsEnabled="{Binding IsInScaleRange}" > </CheckBox> </DataTemplate> </esri:Legend.LayerTemplate> </esri:Legend> </Grid>
<!--MouseOver Information--> <Border x:Name="m_maptip" CornerRadius="10,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Visibility="Collapsed" Background="White" BorderThickness="3" BorderBrush="#3c91c0" Opacity="0.8"> <StackPanel> <sdk:Label x:Name="m_txt_maptip_header" FontFamily="Arial" FontSize="16" Foreground="Red"/> <TextBlock x:Name="m_txt_maptip" Text="Line" Foreground="Black" FontSize="12"/> </StackPanel> </Border> I populate the information into the textblock dynamically
KeyValuePair<int, string> kvpIdentifyLayer = (KeyValuePair<int, string>)cmbxLayerIdentify.SelectedItem; m_txt_maptip.Text = strDisplayInfo; m_txt_maptip_header.Content = "Layer: " + kvpIdentifyLayer.Value; m_maptip.Visibility = Visibility.Visible; m_maptip.Margin = new Thickness(_last_point.X + 10, _last_point.Y + 10, 0, 0); m_txt_maptip_header.Width = m_txt_maptip.Width;
The default legend style doesn't show disabled scrollbars.
Check that there is no implicit style defined for the legend in your project (most generally in app.xaml) that might override the default template.