The AutoComplete control provides DisplayMemberPath and ItemsSource properties to bind the control to data. The ItemsSource property lets you bind the control to an enumerable collection of items, and the DisplayMemberPath property sets the path to a value on the source object for displaying data.
The following code illustrates how to set these properties in code to achieve data binding.
C# |
Copy Code
|
---|---|
autoComplete.ItemsSource = Country.GetCountries();
autoComplete.DisplayMemberPath = "Name";
|