title: WP7 - Scrolling ListBox in external ScrollViewer
body: <p>I have the following page layout in my application:</p>
  
  <pre><code>&lt;Grid x:Name="ContentPanel"
        Grid.Row="1"&gt;
  
    &lt;ScrollViewer x:Name="ScrollViewer1" 
                  MaxHeight="600"
                  VerticalAlignment="Top"
                  HorizontalAlignment="Stretch"&gt;
  
      &lt;StackPanel x:Name="StackPanel1" &gt;
        &lt;TextBlock x:Name="TextBlock1" /&gt;
  
        &lt;toolkit:ListPicker  x:Name="ListPicker1" /&gt;
  
        &lt;TextBlock x:Name="TextBlock2" /&gt;
  
        &lt;TextBox x:Name="TextBlock3" /&gt;
  
        &lt;TextBlock x:Name="TextBlock4" /&gt;
  
        &lt;StackPanel x:Name="StackPanel2" &gt;
  
          &lt;TextBlock x:Name="TextBlock5" /&gt;
  
          &lt;Image x:Name="Image1"/&gt;
  
        &lt;/StackPanel&gt;
  
        &lt;ListBox x:Name="ListBox1"&gt;
          &lt;!--Customize the ListBox template to remove the built-in ScrollViewer--&gt;
          &lt;ListBox.Template&gt;
            &lt;ControlTemplate&gt;
              &lt;ItemsPresenter /&gt;
            &lt;/ControlTemplate&gt;
          &lt;/ListBox.Template&gt;
  
          &lt;ListBox.ItemTemplate&gt;
            &lt;DataTemplate&gt;
  
              &lt;!-- .... --&gt;
  
            &lt;/DataTemplate&gt;
          &lt;/ListBox.ItemTemplate&gt;
  
          &lt;ListBox.ItemContainerStyle&gt;
            &lt;Style TargetType="ListBoxItem"&gt;
              &lt;Setter Property="HorizontalContentAlignment"
                      Value="Stretch" /&gt;
            &lt;/Style&gt;
          &lt;/ListBox.ItemContainerStyle&gt;
        &lt;/ListBox&gt;
  
      &lt;/StackPanel&gt;
  
    &lt;/ScrollViewer&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p>I added an external <code>ScrollViewer</code> instead of the using the <code>ListBox</code>'s because without it the stuff above the <code>ListBox</code> was taking too much room and not leaving enough space to view the <code>ListBox</code> contents. </p>
  
  <p>Now, the problem is if I add an item to the end of the <code>ListBox</code> the <code>ScrollIntoView</code> method does not work. So I need to use the <code>ScrollViewer</code>'s <code>ScrollToVerticalOffset</code> method. </p>
  
  <p>I'm adding the new item to an <code>ObservableCollection</code> that is bound to the <code>ListBox</code> when the user clicks a button on the application bar. How can I calculate the value to be passed to <code>ScrollViewer.ScrollToVerticalOffset</code>?</p>
  
  <p>Thanks for your help!</p>