Skip to main content

NavigationFrame.AnimationSelector Property

Gets or sets an AnimationSelector class descendant that provides a custom storyboard, rendering the forward and backward navigation animation. This is a dependency property.

Namespace: DevExpress.Xpf.WindowsUI

Assembly: DevExpress.Xpf.Controls.v24.1.dll

NuGet Package: DevExpress.Wpf.Controls

Declaration

public AnimationSelector AnimationSelector { get; set; }

Property Value

Type Description
AnimationSelector

An AnimationSelector class descendant that provides a custom storyboard, rendering the forward and backward navigation animation.

Remarks

The NavigationFrame.AnimationType property allows you to enable animation effects when navigating between views. You can also specify animation settings with the NavigationFrame.AnimationSpeedRatio and NavigationFrame.AnimationDelay properties.

However, if these settings do not meet your needs, it is possible to provide a custom forward and/or backward navigation animation. For this purpose, create an AnimationSelector class descendant, and override the SelectStoryboard method, which returns the Storyboard object used to render the navigation animation. This method accepts the animation parameter which comprises the animation settings being used. These settings allow you, for instance, to determine whether forward or backward navigation is performed. Then, assign the created AnimationSelector class descendant to the AnimationSelector property.

Note

If the NavigationFrame.AnimationType setting is set to None, the AnimationSelector property is not in effect.

Example

The example below shows how to provide a custom storyboard used to render backward and forward navigation for a NavigationFrame. The AnimationSelector‘s SelectStoryboard method override returns a storyboard according to the animation direction.

using System.Windows.Media.Animation;

public class FrameAnimationSelector : DevExpress.Xpf.WindowsUI.AnimationSelector {
    private Storyboard _BackStoryboard;
    private Storyboard _ForwardStoryboard;
    public Storyboard ForwardStoryboard {
        get { return _ForwardStoryboard; }
        set { _ForwardStoryboard = value; }
    }
    public Storyboard BackStoryboard {
        get { return _BackStoryboard; }
        set { _BackStoryboard = value; }
    }
    protected override Storyboard SelectStoryboard(DevExpress.Xpf.WindowsUI.FrameAnimation animation) {
        return animation.Direction == DevExpress.Xpf.WindowsUI.AnimationDirection.Forward ? ForwardStoryboard : BackStoryboard;
    }
}
See Also