WPF ListBox的组面板

我有一个列表框,使用GroupStyle对项目进行分组。我想在stackpanel的底部添加一个控件来保存所有组。此附加控件需要是滚动内容的一部分,以便用户滚动到列表的底部以查看控件。如果我使用的是没有组的列表框,则通过修改ListBox模板可以轻松完成此任务。但是,对于分组的项目,ListBox模板似乎仅适用于每个组。我可以修改GroupStyle.Panel,但这不允许我向该面板添加项目。
<ListBox>
<ListBox.ItemsPanel>
    <ItemsPanelTemplate>
        <WrapPanel/>
    </ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.GroupStyle>
    <GroupStyle>
         <GroupStyle.Panel>
             <ItemsPanelTemplate>
                 <VirtualizingStackPanel/>  **<----- I would like to add a control to this stackpanel**
             </ItemsPanelTemplate>
         </GroupStyle.Panel>
        <GroupStyle.ContainerStyle>
            <Style TargetType="{x:Type GroupItem}">
                <Setter Property="Template">
                     <Setter.Value>
                         <ControlTemplate TargetType="{x:Type GroupItem}">
                              <Grid>
                                  <ItemsPresenter />
                              </Grid>
                         </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </GroupStyle.ContainerStyle>
    </GroupStyle>
</ListBox.GroupStyle>
这应该让我知道我需要做什么:     
已邀请:
您可以使用您计划的策略来实现
ListBox
,而只需使用
GroupItem
。如果你将这个XAML添加到你的
GroupStyle
,它将添加一个组结尾
TextBlock
<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>
编辑: 以下是一个完整的仅限XAML的分组列表示例,其中包含滚动条以及添加到滚动区域末尾的其他内容:
<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>
    

要回复问题请先登录注册