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

标签 c# wpf datagrid

我有一个包含 n 行的 DataGrid。当用户到达 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>

关于c# - 如何将按钮附加到数据网格的末尾? (WPF, C#),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28408986/

相关文章:

c# - 数据表:数据表结果中的 System.Byte[] 值

c# - 使用 accord.net 将数据分类为已知模式

c# - 在 DrawText 中设置 VerticalAlignment

c# - DataGridColumnHeader 中的 UserControl 不拉伸(stretch)

c# - 如何使用 TextBox (WPF C#) 过滤 Datagrid 值

c# - 如何固定启动没有目标的特殊文件夹

c# - 是否有按钮的右键单击和滚轮单击控件? C#

c# - 每个 Viewmodel 实例化一个 View(同一类型的多个 View)

c# - WPF WebBrowser C# Windows 不会旋转渲染

c# - WPF DataGrid 过滤的项目,跳跃的滚动条