title: Load More Data When Scroll to Bottom ListBox Silverlight NOT WP7
body: <p>I would like to have a listBox that I will fill with items. When the user scrolls to the bottom of the <code>listBox</code>, the <code>listBox</code> should be loaded with more items.</p>
  
  <p>There are tons of tutorials for doing this in WP7, but I haven't found anything solid for doing this in a Silverlight web app.</p>
  
  <p>While trying different things out, I managed to create a method that can display a Message when a user scrolls to the bottom of the ListBox. This is more of a proof of concept than a final implementation:</p>
  
  <pre><code>ScrollViewer scrollViewer = new ScrollViewer();
  var childScrollViewer = VisualTreeHelper.GetChild(this, 0);
          if (childScrollViewer is ScrollViewer)
              scrollViewer = (ScrollViewer)childScrollViewer;
  
  if (scrollViewer.VerticalOffset &gt;= scrollViewer.ScrollableHeight)
              MessageBox.Show("You're at the bottom!");
  </code></pre>
  
  <p>I'm currently calling this method from the ListBox's <code>MouseWheel</code> event. This approach is not ideal since it doesn't account for users clicking on the scrollbar and dragging it down. This implementation is also poor because the message is displayed when the user scrolls to the top <strong>or</strong> bottom of the listbox. </p>
  
  <p>Here some nice WP7 tutorials I found that I wish could be implemented in a Silverlight web app:</p>
  
  <ul>
  <li><a href="http://danielvaughan.orpius.com/post/Scroll-Based-Data-Loading-in-Windows-Phone-7.aspx" rel="nofollow">Here's a WP7 tutorial I can't use</a></li>
  <li><a href="http://www.manas.com.ar/spalladino/2008/07/02/paging-in-data-bound-listbox-in-silverlight/" rel="nofollow">This one seemed promising but is poorly described and doesn't really work</a></li>
  <li><a href="http://www.codeproject.com/Articles/150166/Loading-Data-when-the-User-Scrolls-to-the-End-of-a" rel="nofollow">Here's another WP7 tutorial I can't use</a></li>
  </ul>
  
  <p>I just need to be pointed in the right direction. Whether it's a tutorial, or a concept I can learn about that might do the trick, or anything else that can help me implement this in a Silverlight web app.</p>