Get selected value from combo box in C# WPF

后端 未结 21 700
粉色の甜心
粉色の甜心 2020-12-08 09:29

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

ComboBox.SelectedValue.toString();
21条回答
  •  渐次进展
    2020-12-08 10:09

    Solving this problem is simple. All I did was to add "SelectedValuePath" to my XAML code and bind it to my model property that I want to return with the combobox.

    
    

提交回复
热议问题