开发者

Binding text in ComboBox vertical instead of Horizontal

I'm trying to troubleshoot my ComboBox. It's declared like this:

<ComboBox x:Name="SampleComboBox" ItemsSource="{Binding Path=SelectedSample.SampleName}" />

SelectedSample returns a custom object, that has a property of SampleName that is a string type. When I check the value while in debug mode, I see the correct text, "Sample 1". But when it appears in the ComboBox, it looks like this:

S
a
m
p
l
e

1

Not sure why it does that because when I create a normal List someProperty, and bind to that property, the data shows up normal.

TestDa开发者_开发百科ta 1
TestData 2
TestData 3
...

Any thoughts? Thanks.


Path=SelectedSample.SampleName 

is treated as IEnumerable and you get an array of characters

Its an ItemSource property so you need to provide IEnumerable<Something> there


The ItemsSource is being set to a string so it is treating it like a char array and putting it in one char at a time. You need to set the itemsource to a list property.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜