CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    1

    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?

    Thanks

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: WPF Databinding Question

    Does your business object implement the INotifyPropertyChange interface?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured