Hi everyone
Could I add an empty record to the end of the grid list to adding a new one record?
p.s.: I know about :
<ig:XamGrid.AddNewRowSettings><ig:AddNewRowSettings AllowAddNewRow="Bottom" /></ig:XamGrid.AddNewRowSettings>
But I want to have this row at the end of the ItemSource list.
Thanks, a lot :)
Hello Gleb,
I am attaching a sample project that demonstrates the behaviors mentioned above. In this case, since the XamGrid.EditingSettings.AllowEditing property is set to "Row," I am utilizing the RowExitedEditMode event. In this event, I check the Index of the row that has exited edit mode to see if it is the last one in the grid. If so, I check to see if any of the cells have a Value, and if so, a new, empty data item is added to the underlying ItemsSource of the XamGrid.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Could you please attach a sample how can I do this?
There currently does not exist a way to place the AddNewRow of the XamGrid into the ItemsSource collection bound to the XamGrid unless that AddNewRow gets committed with a new data item, in which case it essentially just becomes a new Row rather than the AddNewRow. This is because when the AddNewRow is blank, it has no data item actually associated with it, and this remains true until the row is edited.
If you would like to achieve this in an alternate route, I would actually recommend against using the AddNewRow in the XamGrid, and add a placeholder, blank data item to the end of your bound ItemsSource. By handling the CellExitedEditMode or RowExitedEditMode events on the XamGrid, you can catch when this blank row has been edited and add a new blank row to the end of your ItemsSource collection to continue persisting this custom add-new row functionality. The event arguments of these events can net you the Cell or Row that has been edited so that you can check for a Value in your Cell elements to be sure that a Value actually has been added and a new blank row should be created.
Please let me know if you have any other questions or concerns on this matter.