title: Attach event handler from parent class in xaml
body: <p>I have a base class for a window that contains a number of event handlers common for my windows of this type (they fire common validation methods).</p>
  
  <p>Here is an example event handler:</p>
  
  <pre><code>protected virtual void ValidateTextBoxTextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
  {
      ValidateProperty((FrameworkElement)sender, TextBox.TextProperty);
  }
  </code></pre>
  
  <p>and there are approximately 20 of these, covering the common controls.</p>
  
  <p>Each window instance is built from a child class of the base. In the .xaml of the child class I do:</p>
  
  <pre><code>&lt;TextBox 
      TextChanged="ValidateTextBoxTextChanged"/&gt;
  </code></pre>
  
  <p>But when I navigate to this window, I get the following error:</p>
  
  <blockquote>
    <p>Failed to assign to property 'System.Windows.Controls.TextBox.TextChanged'.</p>
  </blockquote>
  
  <p>So it's not finding the event handler. Is there an elegant way I can assign the event handlers without duplicating them in every child class (~ 30 children and counting)?</p>