(X) Hide this SilverlightShow next training events: Getting started with the Silverlight 5 Beta - a free 1 hour webinar on May 11th, by Michael Crump. Join at 10 am PST.
XNA for Windows Phone 7 - a 3 day training by MCC Peter Kuhn. June 1-3, 9 am - 1.30 pm PST. Sign up early-bird for $199.
Skip Navigation LinksHome / News / View News

Binding to Silverlight ComboBox and Using SelectedValue, SelectedValuePath and DisplayMemberPath

+ Add to SilverlightShow Favorites
0 comments   /   posted by Silverlight Show on May 12, 2010
(0 votes)
In this post John Papa explains how to bind a ComboBox to a collection of objects, and then bind a property from the selected object to some other scalar property.

The key here are the DisplayMemberPath and SelectedValuePath properties. These apply to the object that each item in the ComboBox is bound to. In other words, these properties are set to the State, not the ObservableCollection<State>. Also, notice these properties are not data bound, they are instead set to the name of the properties respectively. We do not want the values of the properties here, we want the actual name of the properties (which is why it is called DisplayMemberPath and SelectedValuePath).

Share


Comments

Comments RSS RSS
No comments

Add Comment

 
 

   
  
  
   
Please add 3 and 1 and type the answer here: