3
votes

I have listbox in WP7 where i need to scroll to certain items according to user choice and i use scrolltoview for that. Problem is that i need listbox to scroll listbox enough so that selected item appears aligned to top edge. Right now scrolled item is positioned at bottom.

2

2 Answers

4
votes

Assuming that you have fixed (and known) size items and a fixed (and known) size of listbox, can't you just account for the number of items between the top and bottom of the visible space and adjust your offset accordingly?

0
votes

Unfortunately Matt solution was unusable in this case because listbox items were too big taking almost whole screen per item. But i was able to solve this problem by getting scrollviewer of listbox and use its scroll method to scroll into listbox SelectedIndex. Item is still not positioned perfectly after scrolling but height difference is minimal and acceptable for me.