且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

单击datagrid外部的按钮时如何将新行添加到datagrid(WPF工具包)

更新时间:2023-10-04 14:39:58

在WPF中执行此操作的***方法是使数据源成为可观察的集合.然后,您可以将项目添加到集合中,并且网格将更新.当然,如果您拥有全部的SQL,则应将其添加到数据库中并刷新数据源.
The best way to do this in WPF is to make the data source an observable collection. Then you can add items to the collection and the grid will update. Of course, if you have SQL behind it all, you should add the item to the DB and refresh the data source.