开发者

WPF input datagrid?

I would like to create an input DataGrid - an empty set of rows with the column headers that can be filled with data by a user and then saved to a database. The DataGrid will not be therefore used to display开发者_Go百科 data but acts like an input field. The behaviour would be similar to the one of Excell. The problem is that if the DataGrid has no data provided for it, it is not visible in the application and the user cannot enter anything. Is the DataGrid a good choice? How can this sort of functionality be implemented with a different control? I would prefer to use the DataGrid tough. Thanks a lot for any help on this.


You can enter data in a DataGrid even without provided data at the start of the application. You just need the correct bindings for your ItemsSource, and set CanUserAddRows to true. Also, the class that corresponds to a row of a DataGrid must implement a parameterless constructor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜