Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _firstInViewport = 0;
- _lastInViewport = MainListBox.Items.Count - 1;
- // determine first visible item
- for (int i = 0; i < MainListBox.Items.Count; i++)
- {
- ListBoxItem item = (ListBoxItem)MainListBox.ItemContainerGenerator.ContainerFromIndex(i);
- if (item == null || !IsVisibleInViewPort(item, MainListBox))
- continue;
- _firstInViewport = i;
- break;
- }
- for (int i = _firstInViewport; i < MainListBox.Items.Count; i++)
- {
- ListBoxItem item = (ListBoxItem)MainListBox.ItemContainerGenerator.ContainerFromIndex(i);
- if (item == null)
- {
- continue;
- }
- if (!IsVisibleInViewPort(item, MainListBox))
- {
- _lastInViewport = i;
- break;
- }
- }
Add Comment
Please, Sign In to add comment