用于创建表的 WPF 网格

发布于 2024-08-28 06:08:14 字数 186 浏览 3 评论 0原文

我正在寻找一种网格控件,它允许用户输入值并将其保存到数据库中。 DataGrid 的问题是,如果数据库中没有数据,则网格不可见。在我的应用程序中,用户应该看到一个空网格,并能够用他的数据填充它,然后保存它。当用户移动到最后一行时,还应该自动添加新行。我可以使用数据网格,但以某种方式设置一个允许这种功能的属性吗?我应该使用其他控件吗? 非常感谢您的任何建议。

I'm looking for a type of grid control that would allow the user to enter values and save them to a database. The problem with DataGrid is such that if there are no data from the database already the grid is not visible. In my application, the user should see an empty grid and be able to fill it with his data and then save it. The new rows should also be automatically added when the user moves onto the last row. Could I use the datagrid but somehow set a property that will allow this kind of functionality? Should I use another control?
Thanks a lot for any suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沫尐诺 2024-09-04 06:08:14

如果您有标准的列布局,则使用该布局创建一个 DataTable 并绑定到该布局。然后,当他们想要保存该表不存在的句柄并根据绑定的 DataTable 中的行创建它时。

如果您没有标准的列布局,那么您必须提供某种机制来获取布局。要么处理单元格移动事件并自己创建布局,要么创建另一个控件(表设计器),它可以让您指定布局。完成布局后,您可以执行与上面相同的操作。

If you have a standard column layout then create a DataTable with that layout and bind to that. Then when they want to save handle that the table doesn't exist and create it based on the rows in the bound DataTable.

If you don't have a standard column layout then you'll have to provide some mechanism to get the layout. Either handle the cell move events and create the layout yourself or create another control (table designer) which will let you specify the layout. After you have the layout you can do the same as above.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文