I have just started using WPF forms instead of Windows Forms forms. In a Windows Forms form I could just do:
ComboBox.SelectedValue.toString();
My XAML is as below:
The content is showing as text and the name of the WPF combobox. To get the name of the selected item, I have follow this line of code:
ComboBoxItem ComboItem = (ComboBoxItem)cmbDeviceDefinitionId.SelectedItem;
string name = ComboItem.Name;
To get the selected text of a WPF combobox:
string name = cmbDeviceDefinitionId.SelectionBoxItem.ToString();