How to disable AutoComplete in SfComboBox?
AutoComplete present in the SfTextBoxExt has been disabled using property named “AutoCompleteMode”, which is present inside the SfComboBox and it can be retrieved using “FindVisualChildren” function.
The following code example demonstrates the same.
Xaml
<input:SfComboBox x:Name="sfComboBox" Width="150" DisplayMemberPath="Name" ComboBoxMode="Editable" Loaded="sfCombo_Loaded"/> |
C#:
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject { if (depObj != null) { for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) { DependencyObject child = VisualTreeHelper.GetChild(depObj, i); if (child != null && child is T) { yield return (T)child; } foreach (T childOfChild in FindVisualChildren<T>(child)) { yield return childOfChild; } } } } private void sfCombo_Loaded(object sender, RoutedEventArgs e) { SfTextBoxExt text = FindVisualChildren<SfTextBoxExt>( sfComboBox).First(); if (text != null) text.AutoCompleteMode = AutoCompleteMode.None; } |
Fig 1: With/Without AutoComplete in SfComboBox