Category / Section
How to enable autoappend suggestions in Autocomplete control?
The suggested item can be appended automatically in the textbox, using the IsAutoAppend property. When the property is set to true, the suggested item can be appended.
XAML
<syncfusion:AutoComplete x:Name="autocomplete" Height="30" Width="180" Source="Custom" IsAutoAppend="True" DisplayMemberPath="item"> <syncfusion:AutoComplete.CustomSource> <local:AutoCompleteList/> </syncfusion:AutoComplete.CustomSource> </syncfusion:AutoComplete>
C#
public partial class MainWindow : Window
{
AutoCompleteList obj = new AutoCompleteList();
public MainWindow()
{
InitializeComponent();
autocomplete.CustomSource = obj;
autocomplete.SelectionMode = SelectionMode.Extended;
}
}
public class AutomComp
{
public string item { get; set; }
}
public class AutoCompleteList : List<AutomComp>
{
public AutoCompleteList()
{
this.Add(new AutomComp() { item = "item 1" });
this.Add(new AutomComp() { item = "item 2" });
this.Add(new AutomComp() { item = "item 3" });
this.Add(new AutomComp() { item = "item 4" });
this.Add(new AutomComp() { item = "item 5" });
this.Add(new AutomComp() { item = "item 6" });
}
}
Screenshot:
