Hi Frederick,
Currently, the
desired functionality of receiving an event notification when a combo box input
text is not present in the combo box options is not supported in the SfComboBox
control.
We suggest a
workaround by using a custom filter in the SfComboBox at the sample level to
determine the entered text is present or not in ItemsSource. We want to inform
you that, filter behavior will be activated each time text is entered into the
combo-box input field. The provided code snippet demonstrates how to implement
this workaround, and we have included a sample for your reference. Please
examine the attached sample, and don't hesitate to contact us if you have
additional questions or concerns.
Please refer the
below code snippet for this,
|
//In XAML
<editors:SfComboBox
x:Name="comboBox"
IsEditable="true"
IsFilteringEnabled="true"
ItemsSource="{Binding
Fruits}"
TextMemberPath="Name"
DisplayMemberPath="Name">
<editors:SfComboBox.FilterBehavior>
<local:FilteringBehavior/>
</editors:SfComboBox.FilterBehavior>
</editors:SfComboBox>
//In C#
public class FilteringBehavior
: IComboBoxFilterBehavior
{
public List<int>
GetMatchingIndexes(SfComboBox source, ComboBoxFilterInfo filterInfo)
{
List<int> filteredlist = new
List<int>();
List<Model>? items =
(source.ItemsSource as IEnumerable)?.OfType<Model>()?.ToList(); ;
filteredlist.AddRange(from Model
item in items
where
item.Name.StartsWith(filterInfo.Text,
StringComparison.CurrentCultureIgnoreCase)
select
items.IndexOf(item));
if(filteredlist.Count==0)
{
System.Diagnostics.Debug.WriteLine("Entered item not
available");
}
return filteredlist;
}
}
|
Regards,
Brundha V
Attachment:
ComboBoxMaui_8fe2a8ba.zip