title: WPF: How to trigger target controls to update when changing binding object members
body: <p>I've been searching for hours to figure this out; I am possibly trying to find something that doesn't exist, or my design is off-base.</p>
  
  <p>I have a WPF page with a DependencyProperty that associates with a nested class structure.  eg:</p>
  
  <pre><code>public static readonly DependencyProperty MyDepProperty =
      DependencyProperty.Register("MyDep", typeof(MyGrouping), typeof(MainWindow));
  
  public MyGrouping MyDep {
      get =&gt; (MyGrouping) GetValue(MyDepProperty);
      set =&gt; SetValue(MyDepProperty, value);
  }
  public class MyObject {
      public string A { get; set; }
      public string B { get; set; }
  }
  
  public class MyGrouping {
      public MyObject G1 { get; set; }
      public MyObject G2 { get; set; }
      public MyObject G3 { get; set; }
  }
  </code></pre>
  
  <p>On my page are TextBox controls that bind to paths in this dependency property.  eg:</p>
  
  <pre><code>&lt;TextBox Text="{Binding MyDep.G2.A, Mode=TwoWay,
           UpdateSourceTrigger=PropertyChanged}" Width="50"/&gt;
  &lt;TextBox Text="{Binding MyDep.G2.B, Mode=TwoWay, 
           UpdateSourceTrigger=PropertyChanged}" Width="50"/&gt;
  </code></pre>
  
  <p>Also on my page, for each grouping, is a "clear" button, in which I expect to clear the values in the object.   Trying to keep from having to manipulate TextBox objects in the code-behind, I wanted to be able to adjust values directly in the dependency property and have them reflected in the controls auto-magically.  eg:</p>
  
  <pre><code>    private void G2Clear_OnClick(object sender, RoutedEventArgs e) {
          MyDep.G2.A = MyDep.G2.B = "";
          // ??  What do I do here?
      }
  </code></pre>
  
  <p>So the question is:  Is there a way I can tell WPF to trigger all controls to update to current values in the dependency property's properties?  I've tried a number of methods and they don't seem to work -- InvalidateProperty(), SetPropertyValue(), etc.  (I was shotgunning to see what works.)</p>
  
  <p>My object does have a copy constructor, so I <em>can</em> do this:</p>
  
  <pre><code>MyDep = new MyGrouping(MyDep)
  </code></pre>
  
  <p>And it does effectively update the controls -- but I feel like this is a drastic approach; isn't there some middle ground where I can just have the controls re-evaluate the depencency property without having to name and access each and every control on the page?</p>