Question

I have an autocomplete box where I am trying to bind the selected item to a propery of the item that is actually selected. I.e. I have a Client object with a Name property, and the ItemsSource of my autocomplete box is a List of Clients.

The property I am trying to bind as the selected Item is a String, called SelectedClientName. But because SelectedClientName is not of type Client, I cannot bind it directly.

As a work around, I am using a converter. But I would like to know if there is a way to do this in the binding without converters.

Was it helpful?

Solution

I'd suggest having SelectedClientName not be of a different type, in your case of type string. Keep it the Client type and utilize your Name property where a string is required.

Here's some additional information on binding to complex objects in an AutoCompleteBox: http://www.codeproject.com/Tips/79158/AutoCompleteBox-Binding-Custom-Objects

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top