Geeks With Blogs
Jim Lahman's Blog Fortitude|Endurance|Faith|Teamwork

I have a listView that is populated every 1/2 sec and when I set the TopItem to an ListItem whose index > visible items, then the list jumped between the topItem and back 2 spots.

To correct the problem, I set the TopIterm AFTER the call to EndUpdate as shown in this code snippet:

   1:  lvB.EndUpdate();
   2:  lvI.EndUpdate();
   3:  lvR.EndUpdate();
   4:   
   5:  if (lstEntryInts.Items.Count > 0) lstEntryInts.TopItem = lstEntryInts.Items[iTopVisIdx];
   6:  if (lstEntryBools.Items.Count > 0) lstEntryBools.TopItem = lstEntryBools.Items[iTopVisIdx];
   7:  if (lstEntryReals.Items.Count > 0) lstEntryReals.TopItem = lstEntryReals.Items[iTopVisIdx];
   8:   
   9:  if (lstProcInts.Items.Count > 0) lstProcInts.TopItem = lstProcInts.Items[iTopProcVisIdx];
  10:  if (lstProcBools.Items.Count > 0) lstProcBools.TopItem = lstProcBools.Items[iTopProcVisIdx];
  11:  if (lstProcReals.Items.Count > 0) lstProcReals.TopItem = lstProcReals.Items[iTopProcVisIdx];
  12:   
  13:  if (lstDelvInts.Items.Count > 0) lstDelvInts.TopItem = lstDelvInts.Items[iTopDelvVisIdx];
  14:  if (lstDelvBools.Items.Count > 0) lstDelvBools.TopItem = lstDelvBools.Items[iTopDelvVisIdx];
  15:  if (lstDelvReals.Items.Count > 0) lstDelvReals.TopItem = lstDelvReals.Items[iTopDelvVisIdx];
Posted on Monday, September 6, 2010 3:38 PM | Back to top


Comments on this post: ListView.TopItem property is buggy

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Jim Lahman | Powered by: GeeksWithBlogs.net