I have posted an article at CodeProject on customization of the Silverlight AutoCompleteBox to be used as a type-ahead ComboBox in LOB applications at CodeProject. The AutoCompleteComboBox can be used in typical Object-to-Object associations (one that we typically encounter when creating associations in Entity Framework) as well as Foreign Key associations (the new association type introduced with Entity Framework 4).
Here’s a sample usage of the control in a typical MVVM scenario:
- Object to Object Association:
Example data structure:
public class SalesOrderDetail { Product product; public Product Product { get { return product; } set { product = value; } } }Example control usage:
<custom:AutoCompleteComboBox SelectedItemBinding="{Binding Product, Mode=TwoWay}" ItemsSource="{Binding Path=Products, Source={StaticResource ViewModel}}" /> - Foreign Key Association:
Example data structure:
public class SalesOrderDetail { int productID; public int ProductID { get { return productID; } set { productID = value; } } }Example control usage:
<custom:AutoCompleteComboBox SelectedValue="{Binding ProductID, Mode=TwoWay}" SelectedValuePath="ProductID" ItemsSource="{Binding Path=Products, Source={StaticResource ViewModel}}" />
To view the implementation details, you can read the full article at :
http://www.codeproject.com/KB/silverlight/AutoComplete_ComboBox.aspx
The source code along with a demo project can be downloaded from the article as well as here (28 KB). Remember to rename the file as zip for extraction.

February 6, 2010 at 6:03 AM
Social comments and analytics for this post…
This post was mentioned on Twitter by SilverlightNews: AutoCompleteComboBox for Silverlight – http://snurl.com/ua2i1…
February 11, 2010 at 11:14 AM
[...] Собственно пример простого автозаполнения. Статья. [...]
February 16, 2010 at 5:44 PM
AutoCompleteComboBox for Silverlight « Mehroz’s Experiments…
Thank you for submitting this cool story – Trackback from DotNetShoutout…
June 23, 2010 at 5:37 AM
I have a problem with using AutoCompleteComboBox. In two way binding mode, after setting datacontext to a new domain object instance, autocompletecombobox reverts to previous instance’s value. I have built small app to show this. Where can I upload it? Thank you.
June 23, 2010 at 5:25 PM
Jandos,
You can try uploading your app to skydrive.
January 27, 2011 at 8:21 PM
Hi There,
I would like to use your control inh a RIA service application. The only problem i am having is that this control somehow shows the display items by calling the binding objects ToString method. The problem with that for me is that RIA services generates my client side code and I can’t inherit from them as they are sealed classes. I would like to know if there is a different way to spoecify the display string for the combobox?
Thanks
Paul.
February 1, 2011 at 12:53 PM
Hi Paul,
Although data classes generated by RIA service are
sealedbut those are markedpartialas well. You can add additional functionality to a partial class in a new file as long as you define the same namespace: Have a look here: Partial Classes and Methods