It works if it’s called after the list is populated. It fails if you populate the list and call EnsureVisible in the same call because the listview (and the datagridview) are designed using a remote cached data source that queries the server using a virtual paging system.
it’s logged as WJ-7786, WJ-7787, and WJ-7788 becasue the same issue is present with the datagridview when setting the focus cell and/or scrolling before the data source is connected.
The deferred call is handled internally. There is nothing different you need to do. It’s working fine with the detail view and the datagridview, but it still has problems with the item view probably because of the virtual rendering. You could try to add a timer and scroll on the first tick.
That’s your case, you are populating and scrolling at the same time, when the scroll call reaches the listview it’s not populated yet since the query for the data happens later asynchronously. We have added a deferred call now for this scenario, it seems to work but not always perfectly. Async stuff is a pain.
Try the next build, it should be better at this.
what does “in the same call” mean.
I have a listview which I populate in Form_Start event, one Item is selected by code and I want to ensure that user can see this item.
Can I split in this case the poulating and scroll into view in this case?