Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

EventToCommand with Xamarin Forms Behaviors

$
0
0

I wrote an EventToCommand behavior using Xamarin Forms 1.3 behaviors and I would like to share it with you : anthonysimmon.com/eventtocommand-in-xamarin-forms-apps/

You will find an example where the EventToCommand is bound to the ItemTapped of a ListView so that we can get the tapped item data context inside a command of the ListView data context:

<ListView ItemsSource="{Binding People}">
  <ListView.Behaviors>
    <b:EventToCommandBehavior EventName="ItemTapped" Command="{Binding SayHelloCommand}" EventArgsConverter="{StaticResource ItemTappedConverter}" />
  </ListView.Behaviors>
  <ListView.ItemTemplate>
    <DataTemplate>
      <TextCell Text="{Binding Name}"/>
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>