how to disable auto scrolling in a ListView?


  • Hi,

    As I've mentioned in another thread, I have a ListView showing a "window" into a virtual list of millions of items.  Because of this, I want to completely control the scroll behavior of the ListView... basically any time the list is scrolled, I need to intercept it and retrieve a new set of items for the view.

    My first problem is that I simply cannot figure out how to disable the ListView's default scrolling behavior.  I've hidden the vertical scrollbar of the inner ScrollViewer, which hides the scrollbar but doesn't prevent scrolling.  I've set the CanContentScroll of the ScrollViewer to false, which has no effect whatsoever that I can see.  I even tried subscribing to the RequestBringIntoView event and setting args.Handled to True.  Again, no effect.

    I need to block any and all vertical scrolling, whether due to selection change (e.g. arrow up/down key), mouse wheel, mouse dragging, etc.  It seems like this should be a simple thing.  What am I missing?

    Thursday, March 04, 2010 7:41 PM

All replies

  • Hi Roland,

    Since the ListView itself support virtualization, is it possible to bind the ListView to such a list that, only when an item is being requested by the ListView then the list will retrieve the actual item? If this is possible, then we can just focus on creating such a custom list, and let the ListView control itself to handle the virtualization stuff.

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    If you have any feedback, please tell us.

    The All-In-One Code Framework Project
    My Blog (in Simplified Chinese)
    Monday, March 08, 2010 8:41 AM
  • Hi Jie,

    Yes, this might be possible, depending on the constraints.  But I need a solution that meets the following two requirements:

    The collection being bound to must be observable, because the items shown in the list may change at any time from underneath the view (due to other processes running in the system.)  So item retrieval cannot solely be driven by the whims of the ListView, it must also be possible for other code to change the items currently being viewed at any time.

    It must be possible to "lazy fill" the ListView in response to scrolling events.  Item retrieval in our system can sometimes be slow (imagine something along the lines of needing to retrieve new items from a server running elsewhere on the network.)  So, we can't just block the app while waiting for new items whenever the ListView requests a new item.  If a scroll event occurs, I need to submit a new item request and show the new "rows" to be blank for a moment, and then have them filled in shortly thereafter as items come in.

    Does this seem possible?
    Wednesday, March 10, 2010 9:42 PM