I have binded a list with Editable WPF DataGrid
I want to get only the modified Items from the WPF Data Grid for updation.
Please let me know how to do this.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I have my WPF datagrid app set up as so:
1) Manually defined all the columns, set their bindings and for each binding specified that it notifies on source updates
2) Added an event handler for the datagrid’s SourceUpdated event
3) In the event handler I have only the following code:
updatedItems is a HashSet<> and MyClass is the type of objects bound to the datagrid’s ItemsSouce.
4) When the user clicks on the save button I simply enumerate the hashset. Hashset is nice, because it only contains unique values. So if a row is edited multiple times or even if multiple cells in the same row are edited, the hashset will still only contain a single entry for the object.