It looks like you have ComboBoxItems in a ComboBox, so SelectedValue returns a ComboBoxItem, and ToString therefore returns something like ComboBox SomeValue .
If this happens, you can get the content using ComboBoxItem.Content:
ComboBoxItem selectedItem = (ComboBoxItem)(test_site.SelectedValue); string value = (string)(selectedItem.Content);
However, it is better to use the ComboBoxItems collection instead of ComboBox to set ComboBox.ItemsSource to the desired row collection:
test_site.ItemsSource = new string[] { "Alice", "Bob", "Carol" };
Then SelectedItem will immediately get the selected row.
string selectedItem = (string)(test_site.SelectedItem);
itowlson
source share