Hi there,
I would like to pack more items in a legend control before having to scroll to see all the content.
When there is only one symbol for a layer, I would like to put that symbol to the left of the layer label, on the same line, instead of a having a new line created under for the symbol.
When there is more than a symbol for a layer, I would like to keep the current behavor, the layer name alone on a line with all the symbols under on their own line.
I found this exemple of a legend template on this forum as a starting point but I have been unable to figure out what to do from there to archieve what I want.
<Grid.Resources>
<Style x:Key="ItemsControl" TargetType="esri:Legend">
<Setter Property="LayerItemsMode" Value="Flat" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="esri:Legend">
<ScrollViewer Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
>
<ItemsControl ItemsSource="{TemplateBinding LayerItemsSource}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<!--Layer Item-->
<ContentPresenter Content="{Binding}" ContentTemplate="{Binding Template}" Margin="0,2,0,2" />
<!--Legend Items-->
<ItemsControl ItemsSource="{Binding LegendItems}" >
<ItemsControl.ItemTemplate>
<DataTemplate >
<ContentPresenter Content="{Binding}" ContentTemplate="{Binding Template}" Margin="0,1,0,1" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsPresenter/>
</ItemsControl>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
Does anybody has aready done that or can point me in the right direction ?
Thanks a lot
Frederic