Q:

How to bind a class to WPF AutoCompleteBox?

I've got a class like this:  
class MyClass
{
    public int ID{ get; set; }
    public string Title{ get; set; }
}

Currently I'm binding it to AutoCompleteBox like this:
List<MyClass> lstMyClass = new List<MyClass>();
lstMyClass = context.Sometable;
autoCompleteBox1.ItemsSource = lstMyClass;
autoCompleteBox1.ValueMemberPath = "Title";
autoCompleteBox1.PopulateComplete();

It finds the objects by the title, but in autocomplete part it shows the class definition instead of the items title. Any idea?

A:

You can use ItemTemplate (msdn).
<controls:AutoCompleteBox x:Name="autoCompleteBox1"        
      FilterMode="Contains"              
      IsTextCompletionEnabled="True">
    <controls:AutoCompleteBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Title}" />
        </DataTemplate>
    </controls:AutoCompleteBox.ItemTemplate>
</controls:AutoCompleteBox>

