DataGrid Add row

Jan 3, 2013 at 5:57 PM

I can create a DataGrid in XAML, and I can populate it with some canned data.  i can even then edit the columns. 

but how do you enable the user to add a row?  Documentation says to use an "InsertionRow" in the header or footer, but that class is not in the assembly downloaded here.

Thanks.

-reilly.

Developer
Jan 7, 2013 at 2:35 PM

The InsertionRow is not available in the Toolkit's DataGrid. This version of the DataGrid is a smaller version of the Complete Xceed WPF DataGrid. 

As said on the main page for the Toolkit's DataGrid description : "... but please bear in mind that that product's documentation covers features that may not be available in this Toolkit version."

If you need more features from the toolkit, please have a look at the Xceed WPF DataGrid available here : http://www.xceed.com/Grid_WPF_Intro.html

Jun 21, 2013 at 2:27 PM
You can just add an item into your ObservableCollection which effectively adds a row to the DataGrid. How you get the user to do this is more interesting - you could just have a button below your table. Or you could intercept the return keys on the last cell and then add a row. Maybe you could always have a blank row and filter this out when the user is finished with the table but that would maybe require your viewmodel to be strings. In short, adding a row isn't hard but doing it nicely requires a bit of thought.