title: Forcing all WPF bound controls to update with GetBindingExpression().UpdateTarget()
body: <p>I have a WPF application that includes ~50 controls that are bound to properties on my business object which implements INotifyPropertyChanged.  Here's a quick snippet of my business object:</p>
  
  <pre><code>public class MyBusinessObject : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
  
      private void OnPropertyChanged(PropertyChangedEventArgs e)
      {
          if (PropertyChanged != null)
          {
              PropertyChanged(this, e);
          }
      }
  
      // properties begin here
      private string _name;
      public string Name
      {
          get { return _name; }
          set
          {
              if (_name == value)
              {
                  return;
              }
  
              _name = value;
              OnPropertyChanged(new PropertyChangedEventArgs("Name"));
          }
      }
  
      // constructor, etc. not shown
  }
  </code></pre>
  
  <p>I also have several validation rules that are used to validate the user input in these controls.  I'm using command binding to prevent my user from saving the data if there are any validation errors.  My application also includes a "Reset default values" button which, obviously, will reset the default value for all of the properties on my business object.  This all works exactly as I'd like it to with one exception.  If my user enters invalid data into one or more controls and then clicks the "Reset default values" button, the controls that contain invalid data don't always update as I'd expect.  This happens because of the following code in my property setters:</p>
  
  <pre><code>if (_name == value)
  {
      return;
  }
  </code></pre>
  
  <p>This code exists to prevent unnecessary property changed notifications from occurring when the value entered by my user in the bound UI control is the same value that the property is already set to.  As an example, I have an IntegerUpDown control in my UI (this control is part of the Extended WPF Toolkit from Xceed).  The default value of the property that my control is bound to is 10.  My user deletes the value from the control and my validation rule is triggered which results in a validation error and the UI is updated appropriately with an error adorner, etc.  The value of the property that this control is mapped to hasn't been changed so it's still set to 10.  Now my user clicks the "Reset default values" button which will result in the default value (10) for the property being reset.  However, the value for the property is <em>already</em> set to 10 so the short circuit logic in my setter will return instead of setting the property value.</p>
  
  <p>So now, after my user clicks "Reset default values", I am also forcing an update on my binding target like this:</p>
  
  <pre><code>this.myIntegerUpDown.GetBindingExpression(Xceed.Wpf.Toolkit.IntegerUpDown.ValueProperty).UpdateTarget();
  </code></pre>
  
  <p>This solves my problem but only for this particular control.  Is there any easy way to do this for <em>all</em> of my bound controls without having to specify each one?  Thanks.</p>