Hi Josep,
Thank you for contacting Syncfusion support.
To add the newly typed text as SfComboBoxItem in the SfComboBox , you can handled it using the KeyDown event. In our sample , we have fetch the text which has been typed in the SfComboBox using VisualTreeHelper and added into existing collection of SfComboBox in KeyDown event. Please find the code for the same from below:
Code Behind: [C#]
|
private void combobox_KeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Enter)
{
if (!string.IsNullOrEmpty(textboxext.Text))
{
bool itemexist = false;
CountryList item = new CountryList() { Name = textboxext.Text };
foreach (CountryList item1 in Countries)
{
if (item1.Name == item.Name)
{
itemexist = true;
break;
}
}
if (!itemexist)
{
textboxext.Text = item.Name;
sfComboBox.SelectedValue = textboxext.Text;
countries.Add(item);
}
}
}
} |
We have prepared the sample for your reference and this can be downloaded from the below location.
Regards
Senthil