Hi, basically what I am trying to achieve is to group data within a List view with an expanded set to false - so that basically all you see is the grouped name and count of items - nothing special and easy to work out.
Now for the difficult part (I have spent all day trying different options to get this to work!) when the expander is expended I want to show the items in a wrap panel, so that instead of one column of data you have three or four columns making easier for the user to find the item required. Now this works fine but with one problem, the wrap panel by default will expand to fill the number of data items which if you have two or three hundred items is difficult to display. So I set the width and height of the panel which works, and the scroll bars are visible but they do not work within the wrap panel. If I replace the wrap panel with a stack panel then the scroll bar works but I only get one column of data.
So basically what I need is either a wrap panel that has a working scroll viewer, or another panel that will wrap the data. The third option is to accept the limitations of WPF and just accept the basic stack panel - not one I want to accept having being sold WPF on it's ability to amend the way it displays data.
Xaml used as follows: The bit to change from stack panel to wrap panel is in ItemsPanelTemplate.
<ListView x:Name="ListRes" >
<ListView.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=ResourceName}" Width="90" Height="25"/>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsPanel>
<ItemsPanelTemplate >
<StackPanel Width="300" Height="100" IsItemsHost="True" />
<!--<WrapPanel Width="300" Height="100" IsItemsHost="True" />-->
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="False" >
<Expander.Header>
<DockPanel Background="Aqua">
<TextBlock FontWeight="Bold"
Text="{Binding Name}"
Margin="0,0,0,5"
Width ="150" />
<TextBlock FontWeight="Bold" Text="{Binding ItemCount}" />
</DockPanel>
</Expander.Header>
<Expander.Content>
<Border BorderBrush="RosyBrown" BorderThickness="2" CornerRadius="5">
<ScrollViewer CanContentScroll="True">
<ItemsPresenter />
</ScrollViewer>
</Border>
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
</ListView>