title: WPF ListBox with a ListBox - UI Virtualization and Scrolling
body: <p>My prototype displays "documents" that contain "pages" that are 
  represented by thumbnail images. Each document can have
  any number of pages. For example, there might be 
  1000 documents with 5 pages each, or 5 documents with 1000 pages
  each, or somewhere inbetween. Documents do not contain other documents.
  In my xaml markup I have a <code>ListBox</code>, whose <code>ItemsTemplate</code> 
  references an innerItemsTemplate that also has a <code>ListBox</code>. I want the
  2 levels of selected items so that I can perform various operations
  on documents or pages (delete, merge, move to new location, etc).
  The innerItemsTemplate <code>ListBox</code> uses a <code>WrapPanel</code> as the <code>ItemsPanelTemplate</code>.</p>
  
  <p>For the scenario where I have a large number of documents with a few
  pages each (say, 10000 documents with 5 pages each), the scrolling
  works great thanks to the UI Virtualization by the <code>VirtualizingStackPanel</code>.
  However, I have problems if I have a large number of pages. A document
  with 1000 pages will only display about 50 at a time (whatever fits on the screen), and when I scroll down, the outer <code>ListBox</code> moves to the next document, skipping the 950
  pages or so that were not visible. Along with that, there is no
  <code>VirtualzingWrapPanel</code> so the app memory really increases.</p>
  
  <p>I'm wondering if I am going about this the right way, especially
  since it is sort of difficult to explain! I would like to be able to display
  10000 documents with 1000 pages each (only showing whatever fits on the screen),
  using UI Virtualization, and also smooth scrolling.</p>
  
  <p>How can I make sure the scrolling moves through all of the pages in document 
  before it displays the next document, and still keep UI virtualization?
  The scrollbar seems to only move to the next document.</p>
  
  <p>Does it seem logical to represent "documents" and "pages" -
  with my current method of using a <code>ListBox</code> within a <code>ListBox</code>?</p>
  
  <p>I would very much appreciate any ideas you have.
  Thank You.</p>