开发者

WPF combobox SelectedValue binding to string

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" .../>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜