ListBox Touchpad Scrolling Performance

My problem

I had a problem creating a user-friendly interface for the embedded device. Using the standard ListBox from WPF 4.0, which supports touch events and touch scrolling out of the box, touch scrolling performance is much worse than scrolling by dragging the mouse scroll bar. First of all, when you start scrolling, scrolling stutters for a split second, but enough to feel bad and make the clicks almost unusable (the gesture is completed when the stutter stops, which leads to an absence or minimal response). As a reference, I used scroll scrolling in Windows Explorer, which has no problems and responds smoothly.

Why is touch scrolling for a ListBox so much worse than scrolling with the mouse and scrolling in Explorer?

My test code

<ListBox x:Name="listBox" ScrollViewer.CanContentScroll="False"> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type Brush}"> <StackPanel Orientation="Horizontal"> <Rectangle Width="100" Height="100" Fill="{Binding}" /> <TextBlock Text="{Binding Color}" FontSize="36" Margin="20"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> 

The ItemsSource element has an IEnumerable<Brush> value that contains all 141 brushes in System.Windows.Media.Brushes.

What i tried

I played with some configuration options to no avail. I tried

  • VirtualizingStackPanel.IsVirtualizing both true and false
  • Reducing the number of brushes to 20
  • Explicitly configures ItemsPanel on VirtualizingStackPanel
  • ScrollViewer.CanContentScroll="True" (then difficult, but I think the problem is not fixed)

Since mouse scrolling is fine, I really did not expect them to help anyone, but ... well .. I tried. =)

+6
source share
3 answers

As a workaround, I repeated scrolling using TouchX events. This works as smoothly as you would expect from the system in which it works.

0
source

Have you tried using VirtualizingStackPanel.VirtualizationMode="Recycling" ?

0
source

in the Microsoft.Surface SDK, SurfaceListBox is a very nice control that supports all Microsoft surface touch events

0
source

Source: https://habr.com/ru/post/894804/


All Articles