在运行时将行添加到datagrid [英] addin row to datagrid at run time

查看:61
本文介绍了在运行时将行添加到datagrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


任何人都可以在单击任何按钮时帮助向WPf中的datagrid添加行..

Hi,
Can Anybody help to add row to datagrid in WPf On click of any Button..

推荐答案

If you are using ADO.NET, then just create data row of the table dataRow = dt.newrow(); And do dt.row.add(dataRow); do not forget to do dt.acceptChanges(); .

As WPF binding works in both direction and each UI element update itself, so in this case once row will get added to datatable and if same is applied to grid then grid will get updated automatically.

summery.

1. you just need to add row in datatable.


这篇关于在运行时将行添加到datagrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆