Replies: 4 comments 4 replies
-
If I do this, it scrolls to index 100 :
|
Beta Was this translation helpful? Give feedback.
-
Would be very grateful if someone could suggest a solution or workaround. |
Beta Was this translation helpful? Give feedback.
-
The problem of adding index numbers to list items view is very classic and still lacks a good solution after all these years. This need exists not only for ListView but also for various other collection controls. When I developed native Android apps, I was surprised by the implementation of RecyclerView, although its MVVM isn't as powerful as XAML, it's surprisingly simple to implement sequential numbering. Why not consider implementing this feature in first-party solutions? |
Beta Was this translation helpful? Give feedback.
-
I found the internal implementation of The method accepts item object as the parameter, but it fetches the index of the given item from Items to pass to the next method.The next method takes the index of item and do the stuff to bring it into view. It seems feasible to introduce a method in the ListViewBase class that would accept the item's index rather than the item itself.@ranjeshj |
Beta Was this translation helpful? Give feedback.
-
First asked at community call chat but couldn't get answer or workaround. #9653 (comment)
When dealing with a
ListView
containing duplicate items in itsItemsSource
, there isn't a direct method to specifically bring a duplicate item into view. For instance, if an item appears at index 30 and again at index 100, the challenge is how to scroll to the item at index 100. The commonly known methodListViewBase.ScrollIntoView(object item)
will default to the item at index 30, not the one at index 100.Manually calculating offset to a specific index is not possible when the items are of variable in size because all the containers are not initialized at once.
Test App: https://github.com/w-ahmad/ListViewScrollTest
Beta Was this translation helpful? Give feedback.
All reactions