Guest User

Untitled

a guest
Jun 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. _firstInViewport = 0;
  2. _lastInViewport = MainListBox.Items.Count - 1;
  3.  
  4. // determine first visible item
  5. for (int i = 0; i < MainListBox.Items.Count; i++)
  6. {
  7. ListBoxItem item = (ListBoxItem)MainListBox.ItemContainerGenerator.ContainerFromIndex(i);
  8. if (item == null || !IsVisibleInViewPort(item, MainListBox))
  9. continue;
  10.  
  11. _firstInViewport = i;
  12. break;
  13. }
  14.  
  15. for (int i = _firstInViewport; i < MainListBox.Items.Count; i++)
  16. {
  17. ListBoxItem item = (ListBoxItem)MainListBox.ItemContainerGenerator.ContainerFromIndex(i);
  18. if (item == null)
  19. {
  20. continue;
  21. }
  22.  
  23. if (!IsVisibleInViewPort(item, MainListBox))
  24. {
  25. _lastInViewport = i;
  26. break;
  27. }
  28. }
Add Comment
Please, Sign In to add comment