title: WPF scrolling parent container through child container
body: <p>I'm having some issues trying to figure out how to scroll the content of a grid which is contained inside of a scroll viewer. When trying to scroll with the mouse wheel or pan (with a touch screen), the grid scrolls fine if the mouse/touch point is over an empty area, but if it is above certain controls (ex. a group box) it won't scroll. Is there some property I'm missing to allow the child panels to allow them to scroll their parent containers?</p>
  
  <p><strong>EDIT:</strong>
  I incorrectly stated my original layout. Here's a simplified version of my senario:</p>
  
  <pre><code>&lt;Grid&gt;
      &lt;ScrollViewer Name="MainScrollViewer"&gt;
          &lt;StackPanel&gt;
              &lt;ListBox /&gt;    &lt;--Doesn't Scroll--&gt;
              &lt;Button /&gt;     &lt;--Scrolls Fine--&gt;
              &lt;TextBlock /&gt;  &lt;--Scrolls Fine--&gt;
              &lt;TextBox /&gt;    &lt;--Scrolls Fine--&gt;
              &lt;DataGrid /&gt;   &lt;--Doesn't Scroll--&gt;
          &lt;/StackPanel&gt;
      &lt;/ScrollViewer&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>A coworker pointed out that my issue is due to the fact the controls such as a ListBoxes and DataGrids contain ScrollViewers themselves, this makes sense. His suggestion (which would work but we both agree seems more complex than it should be) is to catch and rethrow the the scroll event in the code behind (and likely have to deal with calculating the smount of offset to scroll) so that it can bubble up to "MainScrollViewer".</p>
  
  <p><strong>EDIT 2:</strong>
  It seems like the only way to achieve this is to use code behind to handle the PreviewMouseWheel event in the parent. That works, but how do I go about implementing the same thing for panning (scrolling by finger on a touch screen)?</p>