I'm currently implementing autocomplete box from syncfusion. The current selection mode is set to Token
<autocomplete:SfAutoComplete x:Name="autoComplete"
DisplayMemberPath="Location"
MultiSelectMode="Token"
HeightRequest="120"
HorizontalOptions="FillAndExpand"
TokensWrapMode="Wrap"
SelectedItem="{Binding SelectedLocation}"
DataSource="{Binding FilteredLocations}"
Text="{Binding SearchLocation, Mode=TwoWay}" >
</autocomplete:SfAutoComplete>
I'm currently using MVVM approach, how do I bind to SelectedLocation without using object base type.
private ObservableCollection<SearchItem> _filteredLocations;
public ObservableCollection<SearchItem> FilteredLocations
{
get { return _filteredLocations; }
set { SetProperty(ref _filteredLocations, value); }
}
What I have that current works
public object SelectedLocation
{
get { return _selectedLocation; }
set
{
SetProperty(ref _selectedLocation, value);
}
}
But I don't want the type to be object, and what I change it to be ObservableCollection<SearchItem>
, SelectedLocation is no longer picked up. May I get tips or suggestions to properly bind to the selecteditem when it's a collection.
What I tried that didn't work
public ObservableCollection<SearchItem> SelectedLocation
{
get { return _selectedLocation; }
set
{
SetProperty(ref _selectedLocation, value);
}
}