Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8102235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:11:33+00:00 2026-06-05T23:11:33+00:00

I have a ListView that shows around 300 items. When something is changed and

  • 0

I have a ListView that shows around 300 items. When something is changed and I need to repopulate the list, I would like the scroll position to be unchanged, so the same items are still visible and in the same position in the list.
The “EnsureVisible” method sucks since it is satisified with “Visible”, not the same position (the result is that the item of interest is always scrolled to the bottom of the list).

My solution to the problem is to to save the (my) “ID” of the List->TopItem, refill the list and then call List->TopItem = newItemWithSameID (needs to be set twice to work for some reason). This works as a charm for basic “ungrouped” lists.

BUT – if the List has “ShowGroups = true” this will not work. The property TopItem will then always be the first item in the list, not the first VISIBLE item as the documenation says.

Is there a solution? I googled around and found another lost soul having the same problem. He had a rather funny discussion on Microsoft support about it, without success.(http://social.msdn.microsoft.com/Forums/en/winforms/thread/8a81c5a6-251c-4bf9-91c5-a937b5cfe9f3).

So – my question is: is there a workaround? I really need the list to be grouped, and I really hates when the list jumps around when something is changed.

I won’t paste any code here, since all the code you need to reproduce this is in the discussion above.

Thanks alot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:11:34+00:00Added an answer on June 5, 2026 at 11:11 pm

    Here’s a workaround that I have used for this problem:

    public ListViewItem RealTopItem
    {
        int i = 0;
        while (i < Items.Count && !ClientRectangle.Contains(Items[i].Bounds))
            i++;
    
        return Items[i];
    }
    

    Unfortunately, it just recently failed for a customer in the while-statement after having worked for a year in my code. In my troubleshooting, I first tried to deactivate groups, and the problem went away. Then as I reactivated groups again, the problem never reoccured. I have no idea right now what could be wrong there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF App that implements a ListView. I would like to show
I have a ListView that shows a list of names. When you select a
i have a ListView that simly shows items on it. I want to load
I have ListView that shows data: <ListView android:id=@+android:id/list android:layout_width=fill_parent android:layout_height=wrap_content> </ListView> The headlines is
I have a ListView that shows a list of search results. To make things
i have a TabLayout that has a ListView to show as intent. I would
I have a ListView that I am populating with items from an ObservableCollection .
A have a ListView that is rendered with multiple items. Now I want to
I have a listview that is loaded with a list of objects that contain
I'm developing a RSS reader android app. I have a ListView that shows my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.