如何在datagrid的末尾附加一个按钮? (WPF,C#) [英] How to append a button to end of datagrid? (WPF, C#)
本文介绍了如何在datagrid的末尾附加一个按钮? (WPF,C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 DataGrid
,其中有n行。当用户到达 DataGrid
的末尾时,应该有一个用于加载更多行的按钮(就像您从某些网站上知道的那样)。我如何定位始终位于 DataGrid
末尾的按钮?
I've got a DataGrid
with n-rows in it. When the user reaches the end of the DataGrid
, there should be a button to load more rows (like you know from some websites). How can I position that button, which always stays at the end of the DataGrid
?
我正在使用C#和WPF
I'm using C# and WPF
推荐答案
修改数据网格的模板:
<DataGrid ItemsSource="{Binding List}">
<DataGrid.Template>
<ControlTemplate>
<DockPanel>
<Button DockPanel.Dock="Bottom" Content="ADD"/>
<ItemsPresenter/>
</StackPanel>
</ControlTemplate>
</DataGrid.Template>
</DataGrid>
这篇关于如何在datagrid的末尾附加一个按钮? (WPF,C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文