简体   繁体   中英

WP7 listbox scroll by item

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.

假设你有固定(和已知)大小的项目和固定(和已知)大小的列表框,你不能只考虑可见空间的顶部和底部之间的项目数量并相应地调整你的偏移量吗?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM