Autocomplete inside ListView

2 posts, 0 answers
  1. Tahmina
    Tahmina avatar
    1 posts
    Member since:
    Oct 2018

    Posted 18 Oct 2018 Link to this post

    Hi I am new to xamarin forms. How can I use selecteditem for the multiple Autocomplete controller which are inside a Listview already

     

     

     

    <telerikDataControls:RadListView x:Name="listView" ItemsSource="{Binding QuantityRows}"  ItemTapped="Item_Selected" Grid.Row="1">
                    <telerikDataControls:RadListView.ItemTemplate>
                        <DataTemplate>
                            <telerikListView:ListViewTemplateCell>
                                <telerikListView:ListViewTemplateCell.View>
                                      <Label Text="{Binding FieldDescription}"></Label>
                                        <telerikInput:RadAutoComplete x:Name="autoCompleteWatermark"                                                         

                                                              ItemsSource="{Binding Listing}" 
                                                              TextSearchPath="Name" 
                                                              VerticalOptions="Start" 
                                                              NoResultsMessage="there are no matching items..." 
                                                              Watermark="Search here..." />
                                       </telerikListView:ListViewTemplateCell.View>
                                </telerikListView:ListViewTemplateCell>
                         </DataTemplate>
                    </telerikDataControls:RadListView.ItemTemplate>
                </telerikDataControls:RadListView>

  2. Didi
    Admin
    Didi avatar
    230 posts

    Posted 23 Oct 2018 Link to this post

    Hi Tahmira,

    Thank you for the provided code.

    I have created a sample example how to achieve the described approach using the new AutoCompleteView control.  We'd recommend AutoCompleteView as it provides more features and is more intuitive compared to the old AutoComplete control.

    In short, what you need to change is the binding of the ItemsSource of the AutoCompleteView as when the control is placed inside an ItemTemplate, its binding context is the corresponding data item of the ListView source.  Using Source property of the binding you could reference the ListView itself and bind to its SelectedItems collection.

    Please take a look at it and let me know if you have any other questions.

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top