The selected item in your combo box is any type of item that is currently located. Therefore, if you bind to a set of strings, then the selected item will be a string:
string mySelectedValue = ((string)MyComboBox.SelectedItem);
If this is a more complex object, you will need to use and use the expected object. If you have XAML using a list item class, for example:
<ComboBox x:Name="MyComboBox"> <ComboBox.Items> <ComboBoxItem> <TextBlock Text="Hello World"/> </ComboBoxItem> </ComboBox.Items> </ComboBox>
You will then access the selected item as follows:
string mySelectedValue = ((TextBlock)((ComboBoxItem)MyComboBox.SelectedItem).Content).Text;
Jason jackson
source share