Back to Devexpress

TableView.ScrollAnimationMode Property

wpf-devexpress-dot-xpf-dot-grid-dot-tableview-58e607b5.md

latest5.4 KB
Original Source

TableView.ScrollAnimationMode Property

Gets or sets the per-pixel scrolling mode. This is a dependency property.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public ScrollAnimationMode ScrollAnimationMode { get; set; }
vb
Public Property ScrollAnimationMode As ScrollAnimationMode

Property Value

TypeDescription
ScrollAnimationMode

A ScrollAnimationMode enumeration value that specifies the per-pixel scrolling mode.

|

Available values:

NameDescription
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.

Example

This example shows how to implement a custom animation displayed when a user vertically scrolls the GridControl (per-pixel scrolling):

  1. Set the TableView.AllowScrollAnimation property to true.
  2. Set the TableView.ScrollAnimationMode property to Custom.
  3. Handle the TableView.CustomScrollAnimation event and specify a custom scroll animation.

View Example: Implement Custom Scroll Animation

xaml
<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>
cs
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);
}
vb
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

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.

wpf-data-grid-implement-custom-scroll-animation-for-per-pixel-scrolling/CS/DXGrid_CustomScrollAnimation/MainWindow.xaml#L11

xml
AllowScrollAnimation="True"
ScrollAnimationMode="Custom"
CustomScrollAnimation="view_CustomScrollAnimation"/>

See Also

Paging and Scrolling

Per-Pixel Scrolling

TableView Class

TableView Members

DevExpress.Xpf.Grid Namespace