Articles in this section
Category / Section

How to disable AutoComplete in SfComboBox?

1 min read

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;

  }

 

C:\Users\keerthana.jegannatha\AppData\Local\Microsoft\Windows\INetCache\Content.Word\sfCombobox.png

            Fig 1: With/Without AutoComplete in SfComboBox

 

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied