Windows Develop Bookmark and Share   
 index > Windows Forms General > listview autoscrolling problem in dotnet
 

listview autoscrolling problem in dotnet

I have another problem with the listview:

The view is set to largeicon and when I fill up the list dynamically with items it scrolls always to the last clicked item. I can drag the scrollbar down but after releasing it jumps right back to the item I clicked and puts it on top. The wierd thing is this only happens while adding items to the view. After completion it behaves normal and I can scroll up and down regardless of the item I clicked.

Any Ideas?

Greetz

Sven.


sven22  Thursday, February 09, 2006 3:10 PM
Wrap your list loading code in BeginUpdate/EndUpdate.
CommonGenius.com  Thursday, February 09, 2006 3:16 PM
nope. The user wants to see the update process which would not be the case with Begin and EndUpdate
sven22  Thursday, February 09, 2006 3:27 PM
Call SelectedItems.Clear before populating the ListView, that will prevent the ListBox from automatically scrolling back to the selected item. I would also recommend disabling the ListView while you are populating it.
CommonGenius.com  Thursday, February 09, 2006 8:49 PM
Thanks for your advice- but maybe I should have added more details to make my reason for this process clearer:

It's a pictureviewer-component. The user klicks on a folder in a TreeView and gets to see its contents as thumbnails. As soon as the user sees the first thumbs rendered he wants to be able to perform at least an "open" operation to view the picture. When the user doubleklicks the item it triggers the opening in another window. After closing it he can go on with another item in the listview. To be able to do so the rendering of the thumbs happens in a separate thread.

An interesting point is: even if I deselect the just clicked item by clicking in the white space between the thumbs it somehow still has focus since the scrollbar keeps jumping back to it.

Is this somekind of bug or am I missing something?
sven22  Friday, February 10, 2006 8:10 AM
I am unclear on exactly what the problem is. Maybe you could post some sample code that reproduces the issue you are seeing.
CommonGenius.com  Saturday, February 11, 2006 3:00 AM

You can use google to search for other answers

Custom Search

More Threads

• Treeview crashes after removing all nodes
• How to disable a checkbox from focusing
• HelpProvider SetHelpKeywordIssue
• draw control runtime in C#
• give application .NET Framework permissions
• mouse events not working on picture box
• Passing a structure/class by ref from one Form to another
• Menu Shortcuts don´t work with ActiveX controls
• spy++
• Pixel Changed Event