One: Get the selected item according to the data source type
kind:
public class Region { public int REGION_ID { get; set; } public string REGION_CODE { get; set; } public string REGION_NAME { get; set; } public int PARENT_ID { get; set; } }
Datasource binding:
// Bind country cbe_Nationality.ItemsSource = new List<Region> () { new Region() { REGION_ID=1, REGION_NAME="中国"}, new Region() { REGION_ID=2, REGION_NAME="美国"} }; cbe_Nationality.SelectedValuePath = "REGION_ID"; cbe_Nationality.DisplayMemberPath = "REGION_NAME"; this.cbe_Nationality.SelectedIndex = 0;
Get the selected item and take out the text display content in it:
// Get binding information Region cbi = ( this .cbe_Nationality.SelectedItem) as Region;
Get the selected item and convert it into an object, you can get the value and text inside