title: is "non-intrusive code-behind" a good or bad practice?
body: <p>I am a bit surprised that while learning WPF/XAML/Silverlight almost all of the XAML/C# examples I have encountered have the "Click" events in the XAML and very few in the Window or Page constructor.</p>
  
  <p>With all the emphasis these days on "non-intrusive Javascript", I would think that more developers would actually be structuring their XAML/code-behind like this:</p>
  
  <p><strong>XAML:</strong></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Button x:Name="btnEdit"/&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p><strong>Code behind:</strong></p>
  
  <pre><code>public Window1()
  {
      InitializeComponent();
  
      btnEdit.Content = "Edit";
      btnEdit.Click += new RoutedEventHandler(btnEdit_Click);
  }
  
  private void btnEdit_Click(object sender, RoutedEventArgs e)
  {
      btnEdit.Content = "This button was clicked.";
  }
  </code></pre>
  
  <p>Any thoughts on why this would be a good or bad practice?</p>