Boardy Boardy - 2 months ago 14
C# Question

Get selected value from combo box in c# wpf

i think this might be a stupid question but I can't find it on the internet.

I have just started using WPF forms instead of WF forms. In a WF form I could just do:


and this would work fine.

How do I do this in WPF it doesn't seem to have the option.



I have figured it out a bit of strange way of doing it compared to the old WF forms:

ComboBoxItem typeItem = (ComboBoxItem)cboType.SelectedItem;
string value = typeItem.Content.ToString();