title: How to call Command from DataTemplate Entry TextChanged Event in Xamarin Forms?
body: <p>Using DataTemplates in a CollectionView...
  I can call a ViewModel's Command from a button like this:</p>
  <pre><code>&lt;Button Text=&quot;Test&quot;
      Command=&quot;{Binding Source={RelativeSource AncestorType={x:Type ContentPage}},
                        Path=BindingContext.TestCommand}&quot;/&gt;
  </code></pre>
  <p>Or from a gesture like this:</p>
  <pre><code>&lt;Frame.GestureRecognizers&gt;
      &lt;TapGestureRecognizer Command=&quot;{Binding Source={RelativeSource AncestorType={x:Type ContentPage}}, Path=BindingContext.TestCommand}&quot;/&gt;        
  &lt;/Frame.GestureRecognizers&gt;
  </code></pre>
  <p>So, why can't I call that command from an Entry's TextChanged Event like this?</p>
  <pre><code>&lt;Entry x:Name=&quot;PortionEntry&quot;
      Text =&quot;{Binding QtyTest, Mode=TwoWay}&quot;&gt;
      &lt;Entry.Behaviors&gt;
          &lt;behavors:EventToCommandBehavior
              EventName=&quot;TextChanged&quot;
              Command=&quot;{Binding Source={RelativeSource AncestorType={x:Type ContentPage}},
                                Path=BindingContext.TestCommand}&quot;/&gt;
      &lt;/Entry.Behaviors&gt;  
  </code></pre>
  <p><em>The code for</em> EventToCommandBehavior <em>works when not used in a DataTemplate</em></p>
  <p>Here is a project illustrating the issue:
  <a href="https://github.com/BullCityCabinets/DataTemplateEventIssue" rel="nofollow noreferrer">https://github.com/BullCityCabinets/DataTemplateEventIssue</a></p>
  <p>I got the button code form these fine folks:
  <a href="https://www.syncfusion.com/kb/11029/how-to-bind-command-from-viewmodel-to-external-itemtemplate-of-xamarin-forms-listview" rel="nofollow noreferrer">https://www.syncfusion.com/kb/11029/how-to-bind-command-from-viewmodel-to-external-itemtemplate-of-xamarin-forms-listview</a></p>
  <p>Thanks!</p>