用空行填充DataGrid [英] Fill up DataGrid with empty rows

查看:112
本文介绍了用空行填充DataGrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 DataGrid 绑定到一个 DataTable 。我想要 DataGrid 总是至少有十个(空)行,如果没有足够的实际数据项(数据一点一点)。 >

I have a DataGrid bound to a DataTable. I want the DataGrid to always have at least ten (empty) rows, also if there are not enough real data-items (the data comes in little by little).

一种方法在初始化时可以轻松地将十个空行添加到 DataTable 中。但是当一个真正的数据项进来时,我不能轻易添加行,我必须找到第一个空行来覆盖它,什么不是很方便。

所以有人知道一个更聪明/内置的方法来实现这一点?

One approach would be to easily add ten empty rows to the DataTable at initialization. But when a real data-item comes in, I can't easily add the row, I have to find the first empty row to overwrite it, what is not very handy.
So someone knows a smarter/built-in way to achieve this?

推荐答案

如果它只是为了布局,你可以简单地添加一个第二个datagrid与10个空行在你的真实数据网格下。或者你采取亵渎Dmitry发布并使用视觉刷子

if its just for layout, you can simply add a second datagrid with 10 empty rows under your real datagrid. or you take the aproach Dmitry posted and use visual brush

这篇关于用空行填充DataGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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