一个ListBox中获取鉴于项目

一个ListBox中获取鉴于项目

本文介绍了一个ListBox中获取鉴于项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与物业VirtualizingStackPanel.VirtualizationMode设置为回收的列表框。
我绑定一个自定义集合(实现的IList 的IList< T> )它。

I have a ListBox with the property VirtualizingStackPanel.VirtualizationMode set to "Recycling".I am binding a custom collection (implements IList and IList<T>) to it.

现在,如果我理解正确的,当数据被束缚,GetEnumerator的叫。结果
,然后属性公共牛逼此[INT指数] {} 被要求在当前视图中的每个项目。

Now, if I understand right, when data is bound, GetEnumerator is called.
And then property public T this[int index] { } is called for every item in the current view.

我的问题是如何获得当前可见(数据加载后)的项目?

My question is how to get the items that are currently visible (after the data is loaded)?

推荐答案

有时回来我也面临着同样的问题。我用列表框的SelectedItem为选定的项目将是可见的总是发现我的问题的解决方法。在我的情况是滚动这是造成问题。你可以看看是否有帮助 - 结果

Sometime back i also faced the same issue. I found a workaround of my problem by using "SelectedItem" of Listbox as selected item would be visible always. In my case it was Scrolling which was causing issue. You can have a look if it helps -
Virtualization issue in listbox

此外 - 的

这篇关于一个ListBox中获取鉴于项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 14:31