当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - WPF ListView items duplicated

问题描述:

I am having a unique trouble with my program. Let me explain the scenario.

I have a ListView that is bound to a ObservableCollection which is initially empty. The observable collection gets it data from an IAsync service.

After loading, the listview shows duplicate of the items. I used snoop to check the bindings and its confirmed that the items source that it is bound to has 2 items, but the listview has created 4 items. Also interestingly the duplicate entries are bound to the right item.

Can anyone shed some light on this matter ?

网友答案:

Try turning off virtualization

VirtualizingStackPanel.IsVirtualizing

Or you may be able to virtualize but turn off recycling

VirtualizationMode Enumeration

分享给朋友:
您可能感兴趣的文章:
随机阅读: