Category / Section
How to load the Entry control in xamarin.forms listview item?
1 min read
ListView allows you load any editable view such as entry, editor, and search bar. To retain the typed value when scrolling, set binding to the Text property.
xaml
<ContentPage xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"> <ContentPage.Content> <syncfusion:SfListView x:Name="listView" ItemSize="70" ItemsSource="{Binding ContactsInfo}"> <syncfusion:SfListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <StackLayout> <Entry Placeholder="Type text here" HeightRequest="70" Text="{Binding Entrytext}" /> </StackLayout> </ViewCell.View> </ViewCell> </DataTemplate> </syncfusion:SfListView.ItemTemplate> </syncfusion:SfListView> </ContentPage.Content> </ContentPage>
C#
public class ListViewContactsInfo : INotifyPropertyChanged { private string entrytext; public ListViewContactsInfo() { } public string Entrytext { get { return this. entrytext; } set { this. entrytext = value; RaisePropertyChanged("Entrytext"); } } public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(String name) { if (PropertyChanged != null) this.PropertyChanged(this, new PropertyChangedEventArgs(name)); } }
Sample link: Load entry in listview