This is a migrated thread and some comments may be shown as answers.

Autocomplete inside ListView

1 Answer 120 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Tahmina
Top achievements
Rank 1
Tahmina asked on 18 Oct 2018, 09:16 PM

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>

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 23 Oct 2018, 12:44 PM
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
Tags
AutoComplete
Asked by
Tahmina
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or