How to bind SfTextBoxExt to Collection using Delimiter
Step 1: Create a Model and ViewModel classes in sample.
Step 2: Create a list of collections in the ViewModel class and add corresponding value.
Step 3: Bind the list of collections into the AutoCompleteSource property and set the Delimiter value.
The following code demonstrates how to bind SfTextBoxExt To Collection using Delimiter
Model.cs
public class Customer
{
private string cust_name;
public string Cust_name
{
get
{
return cust_name;
}
set
{
cust_name = value;
}
}
}ViewModel.cs
class CustomerCollection
{
public ObservableCollection<Customer> customercollection;
public ObservableCollection<Customer> Customercollection
{
get { return customercollection; }
set
{
customercollection = value;
this.raiseProperty("Customercollection");
}
} public CustomerCollection()
{
customercollection = new ObservableCollection<Customer>();
SelectedItems = new ObservableCollection<Customer>();
this.customercollection.Add(new Customer() {Cust_name ="Davis" });
this.customercollection.Add(new Customer() {Cust_name ="Lucas" });
this.customercollection.Add(new Customer() {Cust_name = "John"});
this.customercollection.Add(new Customer() {Cust_name = "Martin"});
this.customercollection.Add(new Customer() { Cust_name = "Anderson"});
}
}
Mainwindow.Xaml
<Window>
<Window.DataContext>
<local:CustomerCollection/>
</Window.DataContext>
<Grid>
<syncfusion:SfTextBoxExt x:Name="textboxext"
Height="30"
Width="130"
Delimiter=","
SearchItemPath="Cust_name"
AutoCompleteMode="Suggest"
AutoCompleteSource="{Binding Customercollection , Mode=TwoWay}"/>
</Grid>
</Window>
You can download the entire source code of this demo from this link: Sample.