title: WPF click event handler get textblock text
body: <p>I have a text block in my xaml:</p>
  
  <pre><code>&lt;DataTemplate x:Key="InterfacesDataTemplate"
                DataType="ca:Interface"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto" /&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="*" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;TextBlock Grid.Column="1" Text="{Binding Path=Name}" 
                     MouseLeftButtonDown="interface_mouseDown"/&gt;
      &lt;/Grid&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>On the code behind I have an event handler for click (double-click)</p>
  
  <pre><code>private void interface_mouseDown(object sender, MouseButtonEventArgs e)
  {
      var tb = sender as TextBox;
      if (e.ClickCount == 2)
          MessageBox.Show("Yeah interfac " + tb.Text);
  }
  </code></pre>
  
  <p>I'm getting a NullReferenceException.</p>