WPF Listbox Selection problem
I have a strange problem with a listbox. I added only the listbox and a button which adds items to the listbox. If I click an item in the listbox it seems to have some strange multi selection mode on or something... i recorded a short screen cast, see for your s开发者_运维技巧elf:
http://www.youtube.com/watch?v=zV4424ipNEA
any ideas whats wrong?That is a known issue, as all those strings are the same the selection gets confused because they all are essentially the same object. If you create two identical strings in .NET it does not necessarily create a new one but may reuse the first instance, i am not an expert on this though.
Either wrap the strings in a class (make them the Content
of a ListBoxItem
for example) or make sure the values are unique.
精彩评论