Force WPF to Commit Changes on Focused Element

Posted by John L. on Stack Overflow See other posts from Stack Overflow or by John L.
Published on 2010-04-15T13:46:46Z Indexed on 2010/04/15 15:13 UTC
Read the original article Hit count: 669

I'm working with VS2010, WPF and EF. I've placed controls on my window by dragging an entity out of the Data Sources toolwindow. I used the "details" setting so my entity is represented by several labels and textboxes. I've also added a button with the following code:

_context.SaveChanges();

When I'm editing data, the changes in whichever textbox has focus are not committed back to the DB. Everything else commits just fine. If I shift focus to another element prior to hitting the save button, it commits as well. I've experienced the same thing with the DataGrid.

I know I'm missing something simple, but I can figure it out. Any ideas on what I'm missing?

Thanks!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about entity-framework