ComboBox Binding to display list but bind selection to entity?

920 views Asked by At

I am using a Silverlight 4 Navigation template. I use a DomainDataSource to load a specific entity called Issue. Each Issue has a Category. But I am not sure of the best way to perform the binding of a combobox so that the combobox is populated with the categories but the selected item is bound to the category of the Issue being edited. I have a method that seems like a total hack. So I would like some adice from the experts.

1

There are 1 answers

1
Jason Wentworth On BEST ANSWER

ComboBox has two different properties you can bind to, it has a ItemsSource, and a SelectedValue.

So in this case you could bind your list of categories tot he ItemsSource, and bind your category on your issue to SelectedValue.

Take a look here for more information: http://johnpapa.net/silverlight/binding-to-silverlight-combobox-and-using-selectedvalue-selectedvaluepath-and-displaymemberpath/