wpf-9791-controls-and-libraries-data-grid-paging-and-scrolling-per-pixel-scrolling.md
To enable per-pixel scrolling, use the property corresponding to the current view:
To provide visual effect, set the TableView.AllowScrollAnimation property to true. The TableView.ScrollAnimationMode and TableView.ScrollAnimationDuration properties allow you to customize the animation. The first property specifies the scrolling mode, the second property specifies the animation length. The following modes are available:
Ease Out
Ease In/Out
Linear
Custom
Tip
In a TreeListView, these properties are: TreeListView.AllowScrollAnimation, TreeListView.ScrollAnimationMode and TreeListView.ScrollAnimationDuration.
Note
If per-pixel scrolling is enabled and rows have different heights, the last (bottom) visible row may not be displayed entirely. Because of the UI virtualization, the GridControl does not know the total viewport height in advance, and the scrolling speed differs depending on which rows are currently visible.
This example shows how to implement a custom animation displayed when a user vertically scrolls the GridControl (per-pixel scrolling):
true.Custom.View Example: Implement Custom Scroll Animation
<dxg:GridControl Name="grid" AutoGenerateColumns="AddNew">
<dxg:GridControl.View>
<dxg:TableView Name="view"
AutoWidth="True"
AllowScrollAnimation="True"
ScrollAnimationMode="Custom"
CustomScrollAnimation="view_CustomScrollAnimation"/>
</dxg:GridControl.View>
</dxg:GridControl>
void view_CustomScrollAnimation(object sender, DevExpress.Xpf.Grid.CustomScrollAnimationEventArgs e) {
e.Storyboard = new Storyboard();
DoubleAnimation animation = new DoubleAnimation {
From = e.OldOffset,
To = e.NewOffset,
Duration = new Duration(TimeSpan.FromMilliseconds(600)),
EasingFunction = new ExponentialEase() { Exponent = 0 }
};
e.Storyboard.Children.Add(animation);
}
Private Sub view_CustomScrollAnimation(ByVal sender As Object, ByVal e As DevExpress.Xpf.Grid.CustomScrollAnimationEventArgs)
e.Storyboard = New Storyboard()
Dim animation As DoubleAnimation = New DoubleAnimation With {.From = e.OldOffset, .[To] = e.NewOffset, .Duration = New Duration(TimeSpan.FromMilliseconds(600)), .EasingFunction = New ExponentialEase() With {.Exponent = 0}}
e.Storyboard.Children.Add(animation)
End Sub