User (Old forums)MemberApril 2, 2008 at 4:50 pmPost count: 23064
I am having this issue.
I have a datagrid that has a childrow. If I focus on a childrow and click a button or other control on the form (The Grid still thinks its focused because it doesn’t fire the LostFocus event and it still has the cell the user was last on in the edit mode)
Now if the user goes to another part of the program and edits some data in the table that happens to be the data in the childrow it won’t let you Update it. And if the user then goes back to the Datagrid and clicks on the same childrow then the changes are lost forever.
The most idea thing would be to make the LostFocus event fire when you leave the grid and go to another control….
But if there is no planned fix for that how can you force the Datagrid to get out of the Edit mode it gets in. I will have to call this whenever a user clicks on a control outside the grid.
Imported from legacy forums. Posted by David (had 2678 views)User (Old forums)MemberApril 4, 2008 at 8:25 amPost count: 23064
I have also noticed this….
If you focus on a child relation in the DataGrid and then go to some other controls on your wpf form and if those controls alter the data in the parent row of the childrow that you were last focused on the changes won’t be made in that parent row. (Changes won’t be made in the childrow either if you alter the same row that you were last focused on in the datagrid) However if you change a data in a childrow that had the same parent as the childrow that was last focused on….the data changes immediately in the database and also in the grid.
Also if you are last focused on the ParentRow and change try to change the data elsewhere other than in the datagrid….you can change any of the childrows properly but still not the parentrow.
I am using these type of statements to change the data:
I thought I could call the EndEdit() method to force the grid to stop being in the edit mode before the above statements but that just throws this exception:
System.InvalidOperationException was unhandled
Message=”An attempt was made to edit an item that is not part of the specified context.”
(I could list the whole Exception if needed)
Imported from legacy forums. Posted by David (had 592 views)User (Old forums)MemberApril 4, 2008 at 10:44 amPost count: 23064
Umm doh. The ParentRow is updating correctly…that was a minor bug on my part. So please ignore the second message in this thread…..however the childrow problem I mentioned above still remains.
So if you are focused on a ChildRow and leave the datagrid to another control and alter the data outside the datagrid on that ChildRow you were last focused on….it doesn’t let you update it…and the data in the datagrid is not updated either.
Imported from legacy forums. Posted by David (had 3932 views)
- You must be logged in to reply to this topic.