Telerik UI for Windows Phone by Progress

The RadAnimation Framework introduces the RadAnimationSelector object. It allows you to easily create and group animations in XAML in the context of a desired UIElement. Thus you can place the specific animations directly under the element they animate.

The usage of a RadAnimationSelector object, provides you with benefits:

  • All of the animations applied to a certain UIElement are placed in a group and it's easier to get and access them.
Tip
To learn about another way to group your animations read the Animation Group topic.
  • When having, for example, different fade animations for several items you don't have to specify the same amount of unique resource keys to them. You can just name them in the same way, for example "FadeAnimation". Later in code behind you have to use only this string. Of course the string can be also defined as resource, which allows you to easily modify its value, when needed.

Here is an example of the usage of RadAnimationSelector. Note that in it, the AnimationName property of the RadAnimation object gets used. Using it, you can later access it through the selector.

CopyXAML
<Rectangle x:Name="animatedRectangle" Width="100" Height="100" Fill="#FF00BDD2">
    <telerikCore:RadAnimationManager.AnimationSelector>
        <telerikCore:RadAnimationSelector>
            <telerikCore:RadFadeAnimation AnimationName="FadeAnimation" />
        </telerikCore:RadAnimationSelector>
    </telerikCore:RadAnimationManager.AnimationSelector>
</Rectangle>
CopyC#
RadAnimationSelector selector = RadAnimationManager.GetAnimationSelector(this.animatedRectangle) as RadAnimationSelector;
RadAnimation animation = selector.SelectAnimation(this.animatedRectangle, "FadeAnimation");

if (animation != null)
{
    RadAnimationManager.Play(this.animatedRectangle, animation);
}