Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.

<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