用于创建表的 WPF 网格
我正在寻找一种网格控件,它允许用户输入值并将其保存到数据库中。 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有标准的列布局,则使用该布局创建一个 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.