title: C#/WPF - Get ScrollViewer scroll position?
body: <p>Okay, so, everyone knows how to set the scroll position of a ScrollViewer. Entire essays and blog entries have been written about <code>ScrollViewer.ScrollToVerticalOffset()</code>, and there are a good few hundred questions with answers about it here.</p>
  
  <p>So, I enter:</p>
  
  <pre><code>myScrollViewer.ScrollToVerticalOffset(280);
  </code></pre>
  
  <p>... and it so kindly scrolls to that location.</p>
  
  <p>The question is, <em>what property now contains 280</em>, so I can retrieve it later?</p>
  
  <p>(Hint: <code>myScrollViewer.VerticalOffset</code> and <code>ContentVerticalOffset</code> are both 0; <code>myScrollViewer.ScrollInfo</code> just plain doesn't exist.)</p>
  
  <p>EDIT: Apparently I need a more detailed demonstration.</p>
  
  <pre><code>private void btnTest_Click(object sender, RoutedEventArgs e) {
    double scrollTarget = 280;
    MessageBox.Show("Target: " + scrollTarget.ToString());
    myScrollViewer.ScrollToVerticalOffset(scrollTarget);
    MessageBox.Show("Now: " + myScrollViewer.VerticalOffset);
  }
  </code></pre>
  
  <p>I must reiterate that this <strong>does scroll</strong> as intended. Goes right exactly where I want it to. But, <code>myScrollViewer.VerticalOffset</code> is set at 0.</p>