Edit this page

How to apply multiple animations for showing and hiding RadDesktopAlert

Using the ShowAnimation and HideAnimation properties of the DesktopAlertManager you could easily apply an animation or group of animations that all RadDesktopAlert instances will use to show and hide. Both properties are of type RadAnimation and only animations that inherits and extents that class could be set to them. RadAnimation class also provides the ability to use some the common animation properties like SpeedRatio and AnimationName.

This is the list of the several build-in animations you could apply:

  • FadeAnimation

  • ResizeAnimation

  • ScaleAniamation

  • SlideAnimation

  • MoveAnimation

You could either set a single animation to the ShowAnimation and HideAnimation properties or use the AnimationGroup to group several animations from the list above and play them simultaneously.

To learn more about the methods and properties exposed by the API for each of the other animations mentioned above take a look at this topic.

Applying AnimationGroup

Using the AnimationGroup class you could group animations and play them simultaneously. You could easily add or remove animation objects of this composite animation using its Children property that is of type IList.

The next code snippet shows how to apply an AnimationGroup to both the ShowAnimation and HideAnimation properties of DesktopAlertManager:

[C#] Applying AnimationGroup

AnimationGroup groupIn = new AnimationGroup();
groupIn.Children.Add(new FadeAnimation() { Direction = AnimationDirection.In });
groupIn.Children.Add(new ScaleAnimation() { Direction = AnimationDirection.In, MinScale = 0.9 });
AnimationGroup groupOut = new AnimationGroup();
groupOut.Children.Add(new FadeAnimation() { Direction = AnimationDirection.Out });
groupOut.Children.Add(new ScaleAnimation() { Direction = AnimationDirection.Out, MinScale = 0.9 });
this.AnimationGroupManager.ShowAnimation = groupIn;
this.AnimationGroupManager.HideAnimation = groupOut;

[VB] Applying AnimationGroup

Dim groupIn As New AnimationGroup()
groupIn.Children.Add(New FadeAnimation() With {.Direction = AnimationDirection.[In]})
groupIn.Children.Add(New ScaleAnimation() With {.Direction = AnimationDirection.[In], .MinScale = 0.9})
Dim groupOut As New AnimationGroup()
groupOut.Children.Add(New FadeAnimation() With {.Direction = AnimationDirection.Out})
groupOut.Children.Add(New ScaleAnimation() With {.Direction = AnimationDirection.Out, .MinScale = 0.9})
Me.AnimationGroupManager.ShowAnimation = groupIn
Me.AnimationGroupManager.HideAnimation = groupOut

You can download a runnable project of the previous example from our online SDK repository here, the example is listed as DesktopAlert/ShowingAndHidingUsingAnimationGroup.

See Also