I have several ListBoxes and have set up the group style to make the groups expanders. I want all of the ListBoxes to use the same style information to make them all expanders, but i want to be able to change the content of the header to be custom for each use of the style.
Is there any way i can take the out of the but still edit the contents of the
Currently, i am using a syntax similar to this:
<ListBox x:Name="listBox1" ItemsSource="{Binding}" Height="571" Width="260">
<ListBox.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" Style="{StaticResource GroupBoxExpander}">
<Expander.Header>
<Grid Width="190" Background="Yellow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Count:" />
<TextBlock Grid.Column="1" Text="{Binding Path=ItemCount}" />
</Grid>
</Expander.Header>
<Expander.Content>
<ItemsPresenter Margin="15,0,0,0"></ItemsPresenter>
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListBox.GroupStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<local:ItemControl1 />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Any help greatly appreciated!
Thanks for reading