I have created a autocomplete Box with multiple selection mode.
var autocompletelabel = new Label
{
Text = el.LabelText,
Margin = new Thickness(0, 5, 10, 0),
TextColor = Color.Black,
FontSize = 16,
HorizontalOptions = LayoutOptions.Fill,
VerticalOptions=LayoutOptions.StartAndExpand
};
SfAutoComplete autocomplete = new SfAutoComplete {
WidthRequest=200
};
if (!String.IsNullOrEmpty(el.Config))
{
var config = JsonConvert.DeserializeObject(el.Config);
if (config.width != 0)
autocomplete.WidthRequest = config.width;
if(!String.IsNullOrEmpty(config.Context))
autocomplete.DataSource=getlist(config.Context);
if(!String.IsNullOrEmpty(config.MultipleSelect))
{
if(config.MultipleSelect=="1")
{
autocomplete.MultiSelectMode = MultiSelectMode.Delimiter;
autocomplete.Delimiter = ",";
}
else
{
}
}
}
autocomplete.DisplayMemberPath = "Label";
autocomplete.SelectedValuePath = "Value";
autocomplete.SuggestionMode = SuggestionMode.Contains;
autocomplete.SuggestionBoxPlacement = SuggestionBoxPlacement.Bottom;
autocomplete.ShowSuggestionsOnFocus = true;
autocomplete.NoResultsFoundText = "No Results Found";
autocomplete.DropDownItemHeight = 45;
autocomplete.SetBinding(SfAutoComplete.SelectedItemProperty, string.Format("[{0}]", el.Prop), BindingMode.TwoWay);
Here I am trying the two way Data Binding using SelectedItemProperty. of autocomplete box My SelectedItem is like [{Label="",Value=""},{Label="",Value=""}] this.
Here I have used Dictionary for DataBinding and el.Prop is the key of the Dictionary and it contans the object of [{Label="",Value=""},{Label="",Value=""}] .For the single selection autocomplete this way of Binding is working fine.But for the multiple selection the Binding is not working for object to control and when i am selecting from control the object is getting binded.
Which proerty should i use while using SetBinding(SfAutocomplete.???,"Prop",BindingMode.TwoWay).Can anyone help me how to do this.