a_anis3000
asked on
Displaying selected item of a wpf ComboBox in a messagebox
I have the following ComboBox in XAML Code
<ComboBox Name="angleComboBox" SelectionChanged="angleCom boBox_Sele ctionChang ed">
<ComboBoxItem>Degree</Comb oBoxItem>
<ComboBoxItem>Radian</Comb oBoxItem>
</ComboBox>
along with its following event handler below
private void angleComboBox_SelectionCha nged(objec t sender, SelectionChangedEventArgs e)
{
string selection = angleComboBox.SelectionBox Item as string;
MessageBox.Show(selection) ;
}
What I am trying to do is get the messagebox to display whatever I am selecting in the combobox for example a messagebox display the word Degree when Degree is selected from the ComboBox. For some reason selecting Degree in the ComboBox yields and empty message box and selecting Radian yields a messagebox with the word Degree instead of Radians.
<ComboBox Name="angleComboBox" SelectionChanged="angleCom
<ComboBoxItem>Degree</Comb
<ComboBoxItem>Radian</Comb
</ComboBox>
along with its following event handler below
private void angleComboBox_SelectionCha
{
string selection = angleComboBox.SelectionBox
MessageBox.Show(selection)
}
What I am trying to do is get the messagebox to display whatever I am selecting in the combobox for example a messagebox display the word Degree when Degree is selected from the ComboBox. For some reason selecting Degree in the ComboBox yields and empty message box and selecting Radian yields a messagebox with the word Degree instead of Radians.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.