TableView.ScrollAnimationMode Property
Gets or sets the per-pixel scrolling mode. This is a dependency property.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v19.1.dll
Declaration
Property Value
Type | Description |
---|---|
ScrollAnimationMode | A ScrollAnimationMode enumeration value that specifies the per-pixel scrolling mode. |
Available values:
Name | Description |
---|---|
EaseOut | Starts quickly and then decelerates. |
Linear | Moves smoothly. |
EaseInOut | Starts slowly, accelerates and then decelerates. |
Custom | A custom animation effect implemented within the TableView.CustomScrollAnimation event handler (TreeListView.CustomScrollAnimation in TreeListView). |
Remarks
To provide a visual effect for per-pixel scrolling, set the TableView.AllowScrollAnimation property to true. The 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
Starts quickly and then decelerates.
Ease In/Out
Starts slowly, accelerates and then decelerates.
Linear
Moves smoothly.
Custom
Handle the TableView.CustomScrollAnimation event, to provide a custom animation effect.
Example
This example shows how to handle the CustomScrollAnimation event to implement custom animation played when grid data is vertically scrolled (per-pixel scrolling). Note the view's AllowPerPixelScrolling and AllowScrollAnimation options must be enabled.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-implement-custom-scroll-animation-for-per-pixel-scrolling-e3120.
- MainWindow.xaml.vb
- Application.xaml
- Products.vb
- MainWindow.xaml
- Application.xaml.vb
- MainWindow.xaml.cs
- Products.cs
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Windows.Media.Animation
Namespace DXGrid_CustomScrollAnimation
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
grid.ItemsSource = GetData()
End Sub
Private Sub tableView1_CustomScrollAnimation(ByVal sender As Object, ByVal e As DevExpress.Xpf.Grid.CustomScrollAnimationEventArgs)
e.Storyboard = New Storyboard()
Dim animation As New DoubleAnimation()
animation.From = e.OldOffset
animation.To = e.NewOffset
animation.Duration = New Duration(TimeSpan.FromMilliseconds(600))
animation.EasingFunction = New ExponentialEase() With {.Exponent = 0}
e.Storyboard.Children.Add(animation)
End Sub
Private Function GetData() As List(Of TestDataObject)
Dim _list As New List(Of TestDataObject)()
For i As Integer = 0 To 99
_list.Add(New TestDataObject() With {.ID = i, .Value = String.Format("Value {0}", i)})
Next i
Return _list
End Function
End Class
Public Class TestDataObject
Public Property ID() As Integer
Public Property Value() As String
End Class
End Namespace
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ScrollAnimationMode property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.