hi
i want to get selected value of a combobox that created in WPF,
i use this code :
private void cmb_StuffGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string str;
ComboBoxItem item = (ComboBoxItem)cmb_StuffGroup.SelectedItem;
str = item.Content.ToString();
MessageBox.Show(str, "ITEM");
}
but when i run this code it stop with InvalidCastExeption in line 4.
whats wrong with this code??
thanks
Getting Combobox Selected Value in WPF
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Mar 21, 2015, 2:10 PM EDT
So I'd try this:
private void cmb_StuffGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}