Get wpf combobox selected value

后端 未结 5 1002
无人及你
无人及你 2021-02-13 17:53

How do I get the selected value (eg Option1) as a string from my example below. I\'ve tried loads of suggestions on Google but can\'t get the string.

5条回答
  •  一个人的身影
    2021-02-13 18:23

    Update your code to get the Content of comboboxItem.

    var selectedValue = ((ComboBoxItem)selectOption.SelectedItem).Content.ToString();
    

提交回复
热议问题