You can use the strategy you plan to use for the ListBox , just do it for GroupItem . If you add this XAML to your GroupStyle , it will add the end of the TextBlock group:
<GroupStyle.ContainerStyle> <Style TargetType="GroupItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <StackPanel> <ContentPresenter/> <ItemsPresenter Margin="5,0,0,0"/> <TextBlock Text="*** End of group ***"/> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> </GroupStyle.ContainerStyle>
Edit:
Here is a complete XAML example of just a grouped list with a scroll bar and additional content added to the end of the scroll pane:
<Grid Height="100"> <Grid.Resources> <PointCollection x:Key="sampleData"> <Point X="1" Y="1"/> <Point X="1" Y="2"/> <Point X="2" Y="3"/> <Point X="2" Y="4"/> <Point X="3" Y="5"/> <Point X="3" Y="6"/> </PointCollection> <CollectionViewSource x:Key="groupedSampleData" Source="{StaticResource sampleData}"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="X" /> </CollectionViewSource.GroupDescriptions> </CollectionViewSource> </Grid.Resources> <ListBox ItemsSource="{Binding Source={StaticResource groupedSampleData}}"> <ListBox.Template> <ControlTemplate TargetType="{x:Type ListBox}"> <ScrollViewer CanContentScroll="True"> <StackPanel> <ItemsPresenter/> <TextBlock Text="*** End of list ***"/> </StackPanel> </ScrollViewer> </ControlTemplate> </ListBox.Template> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Y}"/> </DataTemplate> </ItemsControl.ItemTemplate> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.GroupStyle> <GroupStyle> <GroupStyle.Panel> <ItemsPanelTemplate> <VirtualizingStackPanel/> </ItemsPanelTemplate> </GroupStyle.Panel> <GroupStyle.HeaderTemplate> <DataTemplate> <TextBlock Margin="4" FontWeight="Bold" FontSize="15" Text="{Binding Path=Name}"/> </DataTemplate> </GroupStyle.HeaderTemplate> </GroupStyle> </ItemsControl.GroupStyle> </ListBox> </Grid>
source share