Hi,
I want to restore the selection in the code behind. However I do not get it working.
I use the combobox to filter a ListView and I want to set the SelectedMaterialList in code behind to the current filter, however this doesn't work.
Please see my code snippet below.
<combobox:SfComboBox
Grid.Row="1" Grid.ColumnSpan="3"
Margin="8,0"
DataSource="{Binding Materials}"
ShowClearButton="True"
ClearButtonColor="{DynamicResource PrimaryColor}"
DisplayMemberPath="Name"
MultiSelectMode="Token"
SelectedItem="{Binding SelectedMaterialsList, Mode=TwoWay}"
>
<combobox:SfComboBox.TokenSettings>
<combobox:TokenSettings
FontSize="{OnIdiom Desktop=20, Tablet=20, Phone=14}"
BackgroundColor="{DynamicResource Gray-100}"
FontFamily="{StaticResource Montserrat-Regular}"
TextColor="{DynamicResource Gray-900}"
SelectedBackgroundColor="{DynamicResource PrimaryColor}"
IsCloseButtonVisible="true"
CornerRadius="15" DeleteButtonPlacement="Right"
/>
</combobox:SfComboBox.TokenSettings>
</combobox:SfComboBox>
private IList _SelectedMaterialsList = new ArrayList();
public IList SelectedMaterialsList
{
get => _SelectedMaterialsList;
set
{
if (Equals(value, _SelectedMaterialsList))
return;
_SelectedMaterialsList = value;
OnPropertyChanged();
}
}
Same works fine using WPF.
Thank you for your assistance. It's highly appreciated!