Skip to content

This repository contains sample about how to bind Xamarrin.Forms ListView SelectedItem in MVVM?

Notifications You must be signed in to change notification settings

SyncfusionExamples/xamarin-forms-listview-selected-item-binding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Binding SelectedItem in Listview

ListView support to select the items through binding the SelectedItem property from view model by implementing the INotifyPropertyChanged interface that gives the call back notification to UI.

<syncfusion:SfListView x:Name="listView" 
                       SelectedItem="{Binding SelectedItem}"
                       ItemsSource="{Binding BookInfoCollection}"/>
//ViewModel.cs
public class BookInfoRepository : INotifyPropertyChanged
{
    private object selectedItem;
    public object SelectedItem
    {
        get { return this.selectedItem; }
        set
        {
            this.selectedItem = value;
            this.OnPropertyChanged("SelectedItem");
        }
    }
    public BookInfoRepository()
    {
        SelectedItem = BookInfoCollection[2];
    }
}

To know more about MVVM in ListView, please refer our documentation here

About

This repository contains sample about how to bind Xamarrin.Forms ListView SelectedItem in MVVM?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages