如何将按钮附加到数据网格的末尾? (WPF, C#)

How to append a button to end of datagrid? (WPF, C#)

我有一个 DataGrid 里面有 n 行。当用户到达 DataGrid 的末尾时,应该有一个按钮可以加载更多行(就像您从某些网站上了解到的那样)。我如何定位那个始终位于 DataGrid 末尾的按钮?

我正在使用 C# 和 WPF

修改DataGrid的模板:

<DataGrid ItemsSource="{Binding List}">
    <DataGrid.Template>
        <ControlTemplate>
            <DockPanel>
                <Button DockPanel.Dock="Bottom" Content="ADD"/>
                <ItemsPresenter/>
            </StackPanel>
        </ControlTemplate>
    </DataGrid.Template>
</DataGrid>