title: Eventhandler for WPF control in DataTemplate
body: <p>I've been working with WPF and I have experienced a problem related with DataTemplates.
  I have a view called <strong>DetailPage.xaml</strong> and this view uses a DataTemplate called <strong>Detail.xaml</strong>. I added a textbox to this DataTemplate and I want to handle the TextChanged event. So I made something like this:</p>
  
  <pre><code>&lt;DataTemplate x:Name="DetailContent"&gt;
      &lt;Grid Margin="5" DataContext="{Binding Items[0]}"&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition MaxHeight="80"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;StackPanel Width="432"&gt;
              &lt;TextBox Name="NumeroParadaTB" Text="{Binding NumeroParada}" MaxLength="5" TextChanged="NumeroParadaTB_TextChanged" /&gt;
          &lt;/StackPanel&gt;
      &lt;/Grid&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>Then I created and event handler in <strong>DetailPage.xaml.cs</strong>, like the following:</p>
  
  <pre><code>protected async void NumeroParadaTB_TextChanged(object sender, TextChangedEventArgs e)
      {
          string nroParada = ((TextBox)sender).Text;
  
          if(!string.IsNullOrEmpty(nroParada) &amp;&amp; nroParada.IsDigitsOnly() &amp;&amp; nroParada.Length == 5)
          {
  
          }
      }
  </code></pre>
  
  <p>But when running, and error is thrown saying that the event handler doesn't exist. I guess I'm using the eventhandler in a wrong way.</p>
  
  <p>Thanks!</p>