We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to work with Prism using the EventToCommandBehavior in Xamarin.Forms ListView (SfListView)

You can pass the default event argument as parameter when using Prism Framework EventToCommandBehavior in Xamarin.Forms SfListView.

The prism EventToCommandBehavior will pass the CommandParameterEventArgsParameterPath and EventArgsConverter as parameters. The parameter would be null in the Command execute method, if no value is passed to these parameters.


Add Prism Framework EventToCommandBehavior to ListView. Use EventArgsConverter to pass EventArgs to the Command by default.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
            <helper:Converter x:Key="EventArgsConverter"/>
            <syncfusion:SfListView x:Name="listView" ItemSize="60" ItemsSource="{Binding ContactsInfo}">
                    <behavior:EventToCommandBehavior EventName="ItemDoubleTapped" Command="{Binding ItemDoubleTappedCommand}" EventArgsConverter="{StaticResource EventArgsConverter}"/>
                        <Grid x:Name="grid">
                                <ColumnDefinition Width="70" />
                                <ColumnDefinition Width="*" />
                            <Image Source="{Binding ContactImage}" VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="50" WidthRequest="50"/>
                            <Grid Grid.Column="1" RowSpacing="1" Padding="10,0,0,0" VerticalOptions="Center">
                                <Label x:Name="label" LineBreakMode="NoWrap" TextColor="#474747" Text="{Binding ContactName}"/>
                                <Label Grid.Row="1" Grid.Column="0" TextColor="#474747" LineBreakMode="NoWrap" Text="{Binding ContactNumber}"/>


Returns the value that is the actual event parameter.

namespace ListViewXamarin.Helper
    public class Converter : IValueConverter
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            return value;
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            throw new NotImplementedException();

View sample in GitHub

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile