August 19th, 2009, 04:30 PM
WPF Databinding Question
I am just learning WPF databinding after using ADO for years and I am trying to figure out one thing that hopefully you can help with:
I have a business object class called Quote, which is a UserControl's datacontext is bound to. In that usercontrol, I have several textboxes bound to the properties of the quote class and everything is working perfectly fine. I have an update button that sends the changes to the database and that is working fine also.
The problem is that I would like the database to update after the text in any of the textboxes changes (not the textchanged event, but after the textbox loses focus.) That was easily accomplished in .NET with the textbox_validated event. WPF does not have this. I have tried updating the database in the textbox_lostfocus event, but it does not work because the property bound the the textbox does not get updated until after the event finishes. I don't really want to add a call to update the database in the setter of the property. Does anyone know a way to accomplish this?
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!