title: How do I change TextBox.Text without losing the binding in WPF?
body: <p>In a WPF application, I am creating a setting window to customize keyboard shortcuts.</p>
  
  <p>In the textboxes, I handle the KeyDown event and convert the Key event to a human readable form (and also the form in which I want to have my data).</p>
  
  <p>The text box is declared like this</p>
  
  <pre><code>&lt;TextBox Text="{Binding ShortCutText, Mode=TwoWay}"/&gt;
  </code></pre>
  
  <p>and in the event handler, I tried using both</p>
  
  <pre><code>(sender as TextBox).Text = "...";
  </code></pre>
  
  <p>and</p>
  
  <pre><code>(sender as TextBox).Clear();
  (sender as TextBox).AppendText("...");
  </code></pre>
  
  <p>In both of these cases, the binding back to the viewmodel does not work, the viewmodel still contains the old data and does not get updated.
  Binding in the other direction (from viewmodel to the textbox) works fine.</p>
  
  <p>Is there a way I can edit the TextBox.Text from code without using the binding?
  Or is there an error somewhere else in my process?</p>