Skip to content

Instantly share code, notes, and snippets.

@asimmon
Last active November 20, 2015 15:57
Show Gist options
  • Save asimmon/cb80fe2ce83caf65aaae to your computer and use it in GitHub Desktop.
Save asimmon/cb80fe2ce83caf65aaae to your computer and use it in GitHub Desktop.
EventToCommand Xamarin Forms - Example View
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:b="clr-namespace:HelloEventToCommand.Behaviors;assembly=HelloEventToCommand" xmlns:c="clr-namespace:HelloEventToCommand.Converters;assembly=HelloEventToCommand" x:Class="HelloEventToCommand.Views.HomeView">
<ContentPage.Resources>
<ResourceDictionary>
<c:ItemTappedEventArgsConverter x:Key="ItemTappedConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<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>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment