title: ListBox touch scrolling performance
body: <h2>My Problem</h2>
  
  <p>I have a problem with developing a touch friendly UI for an embedded device. 
  Using the standard ListBox from WPF 4.0, which supports touch events and touch scrolling out of the box,  the touch scrolling performance is way worse than scrolling via pulling the scrollbar with a mouse.
  Most notably, when starting a scroll flick, the scrolling stutters for a fraction of a second, but enough to feel bad and make flicks almost unusable (the gesture is complete when the stuttering stops, resulting in no, or minimal response).
  As a reference I used touch scrolling in Windows Explorer, which has no problems and reacts smoothly.</p>
  
  <p>Why is touch scrolling for the ListBox that much worse than both scrolling with the mouse, and touch scrolling in the explorer?</p>
  
  <h2>My Test Code</h2>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ListBox x:Name="listBox"
           ScrollViewer.CanContentScroll="False"&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate DataType="{x:Type Brush}"&gt;
              &lt;StackPanel Orientation="Horizontal"&gt;
                  &lt;Rectangle Width="100"
                              Height="100"
                              Fill="{Binding}" /&gt;
                  &lt;TextBlock Text="{Binding Color}" FontSize="36" Margin="20"/&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;            
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>The ItemsSource is set to an <code>IEnumerable&lt;Brush&gt;</code> containing all 141 brushes in System.Windows.Media.Brushes.</p>
  
  <h2>What I tried</h2>
  
  <p>I've played around with some configuration options without avail. I tried</p>
  
  <ul>
  <li><code>VirtualizingStackPanel.IsVirtualizing</code> both true and false</li>
  <li>Reducing the number of brushes to 20</li>
  <li>Explicitly settings the ItemsPanel to a VirtualizingStackPanel</li>
  <li><code>ScrollViewer.CanContentScroll="True"</code>  (hard to jugde then, but I think the problem persists)</li>
  </ul>
  
  <p>Since mouse scrolling is fine, I didn't really expect these to help any, but.. well.. I tried. =)</p>