Skip to main content
All docs
V24.2

TreeViewControl.CustomScrollAnimation Event

Allows you to create a custom animation when TreeViewControl data is vertically scrolled (per-pixel).

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public event TreeViewCustomScrollAnimationEventHandler CustomScrollAnimation

Event Data

The CustomScrollAnimation event's data class is DevExpress.Xpf.Grid.TreeList.TreeViewCustomScrollAnimationEventArgs.

Remarks

To create a custom animation for per-pixel scrolling, set the AllowScrollAnimation property to true and the ScrollAnimationMode property to Custom.

Example

The following images demonstrate the difference between the default scroll animation and the scroll animation created in the code sample below.

DefaultScrollAnimation CustomScrollAnimation

<dxg:TreeViewControl ...
                     x:Name="treeview"
                     AllowScrollAnimation="True"
                     ScrollAnimationMode="Custom"
                     CustomScrollAnimation="treeview_CustomScrollAnimation"/>
using System.Windows.Media.Animation;

void treeview_CustomScrollAnimation(object sender, DevExpress.Xpf.Grid.TreeList.TreeViewCustomScrollAnimationEventArgs e) {
    e.Storyboard = new Storyboard();
    DoubleAnimation animation = new DoubleAnimation();
    animation.From = e.OldOffset;
    animation.To = e.NewOffset;
    animation.Duration = new Duration(TimeSpan.FromMilliseconds(600));
    animation.EasingFunction = new ExponentialEase() { Exponent = 0 };
    e.Storyboard.Children.Add(animation);
}
See Also