Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,
i am using Datagrid in my WPF Application which is editable and user can add row by clicking or using enter key.
i want to save the data of editable row on button click also.Means i want to create same fuctionality of saving data in the same way it is happening with click and Enter key.
Please help me

TIA

What I have tried:

i tried with
datagridregedt.CommitEdit()
method but is is not reflecting.
Posted
Updated 4-Dec-17 7:19am
Comments
[no name] 2-Dec-17 9:40am    
Maybe this helps: Commit datagridview changes[^]
sumitk.cadc 3-Dec-17 7:53am    
hi,
thanks for posting the link,
but this is for WinForm Datagrid. it wont work for WPF datagrid
Thanks

1 solution

I wouldn't allow adding rows through the grid itself. Create an add button bound to a command that creates a new view model for the view model collection (hopefully the grid items are view models), then set the selected row in edit mode to the new view model.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900