Quantcast
Viewing latest article 3
Browse Latest Browse All 11

Set ListView scroll position

OK, it's a two year old thread, but maybe someone else will need this info one day...

I've found the best answer to this (for me) is the following:

 

//save scroll position

int idx = listView.Items.IndexOf(listView.TopItem);

...

 

//restore vertical scroll position (if records were added or deleted things may get weird)

 

try

{

listView.TopItem = listView.Items[idx];

}

 

catch (Exception ex)

{

 

Debug.WriteLine("Error restoring scroll position: "+ ex.Message);

}

The LockWindowUpdate function is cool -- it totally eliminates the flash when I clear/refill the listview.

 


Viewing latest article 3
Browse Latest Browse All 11

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>