I've bound my ComboBox
SelectedValue
to a string
in my codebehind, but when the value is set, the s开发者_如何学Ctring becomes a ComboBoxItem
. How do I just bind the selected value as a string?
This is probably because you have ComboBoxItem
objects as items in your ComboBox
and string is a content of each ComobBoxItem
. So try setting SelectedValuePath
to "Content" on your ComboBox
:
<ComboBox SelectedValuePath="Content" .../>
精彩评论