none
How to set the size of the Thumb? RRS feed

  • Question

  • I have ListView within a GridView. The datacontext for the ListView are 1,000 items, for example. At the startup only load 100 items are loaded. When the user scrolls to end of the ListView, a event will be thrown to load the next set of items, and so on. </br>

    Unfortunately the Thumb of the ScrollBar shows only the size for the current amount of items. Is it possible to set the size of the Thumb that its size represents a datacontext of 1,000 items.

    Thank you for your comments.
        -Daniel
    Wednesday, April 12, 2006 7:06 AM

Answers

  • The thumb is generated based on UI real-estate calculations, not the number of items in the bound list, so I don't think this is going to be possible.

    You should probably handle this in your model and not the view. Is the goal to simply not have to wait at startup time for all the data to load from the data source? I can provide some suggestions around using a custom aynchronus DataSourceProvider if you need some help. That combined with setting VirtualizingStackPanel.IsVirtualizing="True" on the ListBox will probably ensure the best possible user experience.

    HTH,
    Drew

    Wednesday, April 12, 2006 4:55 PM
    Moderator

All replies

  • The thumb is generated based on UI real-estate calculations, not the number of items in the bound list, so I don't think this is going to be possible.

    You should probably handle this in your model and not the view. Is the goal to simply not have to wait at startup time for all the data to load from the data source? I can provide some suggestions around using a custom aynchronus DataSourceProvider if you need some help. That combined with setting VirtualizingStackPanel.IsVirtualizing="True" on the ListBox will probably ensure the best possible user experience.

    HTH,
    Drew

    Wednesday, April 12, 2006 4:55 PM
    Moderator
  • I'm not sure if theVirtualizingStackPanel is what I need. I have to load lots of (>3000) records from a DB. For example, I'd like to show the records of the database-table 'Customers' in a ListView. On startup I only load 100 contacts. When the user scrolls down I double the size and  load the next set (now 200 items) of contacts from the database. If the user isn't scrolling to the contacts starting wiht 'Z' I don't have to load all the records.

    Do you think virtualization is still helpful for me? If so, may you can give an example or just an hint how to solve this?

    Thanks.
        - Daniel
    Wednesday, April 12, 2006 8:04 PM