Reputation: 908
When I tap and hold and move my list around, it moves, but when I no longer hold, it smoothly scrolls back to beginning of the list. How do I prevent it?
I also tried putting whole ItemsControl inside ScrollViewer - same behavior.
Without ScrollViewer ItemsControl doesn't scroll at all.
I set breakpoints to ManipulationCompleted of ItemsPresenter, ItemsControl and ScrollViewer - in all of them scroll appears in correct position where I left it, but afterwards somewhere it scrolls back.
Here's my xaml markup:
<Grid x:Name="LayoutRoot">
<ItemsControl Name="lbDeployments"
ItemsSource="{Binding Path=Deployments}"
ItemTemplate="{StaticResource DeploymentItem}" >
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<Grid>
<ScrollViewer>
<ItemsPresenter />
</ScrollViewer>
</Grid>
</ControlTemplate>
</ItemsControl.Template>
</ItemsControl>
</Grid>
Please help
Upvotes: 0
Views: 752
Reputation: 11858
Try adding RowDefinitions
:
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid>
...
</Grid>
Upvotes: 1
Reputation: 65564
The issue is that the ScrollViewer needs a container of a fixed size to know much it can actually scroll.
You'll need to set the height of the ScrollViewer or the grid that contains it for scrollign to work properly.
Without doing this the scrollviewer thinks it can take as much space as it likes. When this is the case it doesn't need to scroll and what you see when manipulating the content directly isn't actually scrolling but just moving the content wihtin the scrollable area.
Upvotes: 1