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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to turn Events into Commands with Behaviors in SfListView?

In SfListView, Event can be turned into the Command using Behaviors to follow the MVVM pattern.

To achieve this, need to create a Command for the ItemTapped event of SfListView in ViewModel.



And associate that Command to the appropriate Event of SfListView using Behaviors like below.




Now, when tapped on the ListViewItem, corresponding Command in ViewModel will be invoked automatically and performed the desired operation as shown in below screenshot.


Click here to download the sample.

Article ID: Published Date: Last Revised Date: Platform: Control:
7523 02/28/2017 11/27/2017 Xamarin.Forms SfListView
Did you find this information helpful?
Dave Friedel Oct 29, 2017

To make this a tad more helpful, one should reference the "local:EventToCommandBehavior" which is outlined on this page.  https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/behaviors/reusable/event-to-command-behavior/

Dave Friedel Oct 29, 2017

To Be Honest - you should make a Command Property like other vendors.  Make your controls robust as possible to make the developer's lives easier.

Muthu Kumaran Gnanavinayagam [Syncfusion] Nov 02, 2017

Hi Dave,


Thanks for your valuable feedback. We are already have plan to provide Command for the applicable events. This feature is in queue and will implement in any our upcoming release.



G.Muthu Kumaran.

Add Comment
You must log in to leave a comment

Please sign in to access our KB

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

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