1

I have a listbox in a WP7 application and I would like to retrieve a list of visible items in the listbox. Actually, I am trying to retrieve the object that is visible so that when my application is tombstoned, I can resume it and write listbox.ScrollIntoView(lastVisibleItem);

If it matters, listbox is bound to a collection of custom objects with a datatemplate for customizing the way it looks.

Thanks in advance.

ListBoxer
  • 11
  • 2

1 Answers1

0

It's possible to work out how far the list has been scrolled using the technique detailed in this answer.

You could then calculate which item(s) are displayed based on the size of the list and the height of the items displayed.

If different items can be diffferent sizes then this becomes more difficult as you need to consider the height of each individual item.

You also need to remember that only part of an item may be displayed.

Community
  • 1
  • 1
Matt Lacey
  • 65,560
  • 11
  • 91
  • 143