简体   繁体   中英

Navigate to one specific Item from one group with LongListSelector

I'm using a long list selector in a WP8 application.
The items are grouped alphabetically.

When I'm navigating to this page, sometimes I want the list to be scrolled to one specific item from one group.
I tried the function ScrollTo(), but this can take me only to one specific group from the list.

Is there a way to achieve this?

Yes, there is a way to achieve that.

To explain it better to you i would need to know how you have the groups organized. I'll post here a sample that I hope can help you.

longListSelector.ScrollTo(((AlphaKeyGroup<Object>)longListSelector.ItemsSource[x])[y]);

Where x is the group index, and y is the item index inside the group

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