AutoComplete Selected Item Problem

May 19, 2010 at 10:44 AM

HI,

I am using WPF AutoComplete and I am binding it with Customers Collection not the string Collection.

Every thing is working fine except when I give DataContext of my order form an Order Object, which  has Customer. But it doesn't display customer name in my autocomplete box. CustomerACTB.SelectedItem hasCustomer object. I have to provide CustomerACTB.Text = Order.Customer.Name to fili it which I dont want. Any help or sample? Thanks

 

 

<System_Windows_Controls:AutoCompleteBox  

ValueMemberBinding="{Binding Name, Converter={StaticResource CustomerConverter

}}"

 

VerticalAlignment="Center" Margin="5,0" x:Name="CustomerACTB"

 

 

SelectedItem="{Binding Customer,Mode=TwoWay}" Width="300"

>

 

 

<System_Windows_Controls:AutoCompleteBox.ItemTemplate

>

 

 

<DataTemplate

>

 

 

<TextBlock Text="{Binding Name, Converter={StaticResource CustomerConverter

}}" />

 

 

</DataTemplate

>

 

 

</System_Windows_Controls:AutoCompleteBox.ItemTemplate

>

 

 

</System_Windows_Controls:AutoCompleteBox

>