microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.28k stars 674 forks source link

Proposal: Expose a method in ListViewBase that allows scrolling to a specific item using the item's index. #9890

Open w-ahmad opened 1 month ago

w-ahmad commented 1 month ago

Proposal: Expose a method in ListViewBase that allows scrolling to a specific item using the item's index.

Summary

There should be a method in ListView that can scroll items into view by their index. Currently there is ScrollIntoView(object item) that accepts item itself to bring into view. This method isn't useful when there are duplicate items in the ItemsSource. It only brings first matching index to the view.

To bring the items into view by calling ScrollIntoView(object item), the internal implementation uses item's index. https://github.com/microsoft/microsoft-ui-xaml/blob/66a7b0ae71c19f89c6a7d86a1986794ad1a1bf09/src/dxaml/xcp/dxaml/lib/Selector_Partial.cpp#L3176 This method accepts the item's index rather than the item itself. It seems possible to expose a method like ScrollIntoView(int index) in ListViewBase.

Rationale

Scope

Capability Priority
This proposal will allow developers to scroll any index within the ListViewBase by using it's index. Must
github-actions[bot] commented 1 month ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.