title: How do I pass changes from source in a TwoWay binding?
body: <p>I have created a custom TextBox control (but not derived from TextBox) that contains a Dependency Property "Text".</p>
  
  <p>I have added an instance of this and bound it to a property on my view model using a TwoWay binding.</p>
  
  <p>From within my custom TextBox control, how do I update the Text property in such a way that the change is propagated to the property on the view model?</p>
  
  <p>If I set the "Text" property on my custom control, that replaces the binding leaving the property on the view model as null.</p>
  
  <p>I would have thought this would be simple but I can't see how to do it (the standard TextBox control must do it!)</p>
  
  <p>Cheers</p>
  
  <p>Edit: </p>
  
  <p>Custom Control:</p>
  
  <pre><code>public class SampleCustomControl : CustomControl
  {
      public string Text
      {
          get { return (string)GetValue(TextProperty); }
          set { SetValue(TextProperty, value); }
      }
  
      public static readonly DependencyProperty TextProperty =
          DependencyProperty.Register("Text", typeof(string), typeof(SampleCustomControl), new PropertyMetadata(null));
  
      public void Update()
      {
          // This replaces my binding, I want it to pass the new value 
          // through to the "SomeProperty" two way binding.
          Text = "some value";
      }
  
  }
  </code></pre>
  
  <p>Usage:</p>
  
  <pre><code>&lt;Controls:SampleCustomControl Text="{Binding SomeProperty, Mode=TwoWay}" /&gt;
  </code></pre>