简体   繁体   English

如何将按钮附加到datagrid的结尾? (WPF,C#)

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

I've got a DataGrid with n-rows in it. 我有一个带有n行的DataGrid When the user reaches the end of the DataGrid , there should be a button to load more rows (like you know from some websites). 当用户到达DataGrid的末尾时,应该有一个按钮来加载更多行(就像你从一些网站知道的那样)。 How can I position that button, which always stays at the end of the DataGrid ? 如何定位始终位于DataGrid末尾的按钮?

I'm using C# and WPF 我正在使用C#和WPF

Modify the Template of the DataGrid: 修改DataGrid的模板:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM