Skip to content

ListView EnsureVisible #380

Closed
Closed

Description

@itg-assistant

Gunter asked 2016-11-12 21:12:52 UTC

Hi

how can I scroll an Item of a ListView into the visible area by code, I tried EnsureVisible, but It seems to have no effect

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-11-14 16:35:12 UTC

    Hi Gunter,

    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.

    Thanks,

    Luca

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Gunter answered 2016-11-14 20:43:50 UTC

    Hi Luca

    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?

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-11-14 21:36:52 UTC

    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.

    /Luca

  4. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Gunter answered 2016-11-16 14:43:06 UTC

    Hi Luca

    The deferred call no, that you mentuion, how does it work?

  5. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2016-11-16 19:03:54 UTC

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions