ComboBox Binding to display list but bind selection to entity?
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 开发者_StackOverflowis 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.
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/
精彩评论