ConnectedAnimationService ConnectedAnimationService ConnectedAnimationService ConnectedAnimationService Class

Definition

Represents a service that provides properties and methods to display a ConnectedAnimation.

public : sealed class ConnectedAnimationService : IConnectedAnimationService
struct winrt::Windows::UI::Xaml::Media::Animation::ConnectedAnimationService : IConnectedAnimationService
public sealed class ConnectedAnimationService : IConnectedAnimationService
Public NotInheritable Class ConnectedAnimationService Implements IConnectedAnimationService
Attributes

Windows 10 requirements

Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Examples

This example shows how to animate an image between two pages during a navigation.

SourcePage.xaml/SourcePage.xaml.cs

<Image x:Name="SourceImage"
       Width="200"
       Height="200"
       Stretch="Fill"
       Source="Assets/StoreLogo.png" />
private void NavigateToDestinationPage()
{
    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("image", SourceImage);
    Frame.Navigate(typeof(DestinationPage));
}

DestinationPage.xaml/DestinationPage.xaml.cs

<Image x:Name="DestinationImage"
       Width="400"
       Height="400"
       Stretch="Fill"
       Source="Assets/StoreLogo.png" />
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    base.OnNavigatedTo(e);

    ConnectedAnimation imageAnimation = 
        ConnectedAnimationService.GetForCurrentView().GetAnimation("image");
    if (imageAnimation != null)
    {
        imageAnimation.TryStart(DestinationImage);
    }
}

Remarks

To get an instance of ConnectedAnimationService, call the static GetForCurrentView method.

When you call PrepareToAnimate, you supply a key to associate with the newly created ConnectedAnimation returned by the method. You can later use this key to retrieve the same animation by calling GetAnimation. This lets you connect the animation between two different pages without having to manually pass the reference to the ConnectedAnimation object between pages.

See the Connected animation sample for a complete example of ConnectedAnimationService.

Properties

DefaultDuration DefaultDuration DefaultDuration DefaultDuration

Gets or sets the default time that the animation runs.

DefaultEasingFunction DefaultEasingFunction DefaultEasingFunction DefaultEasingFunction

Gets or sets the default CompositionEasingFunction used by the animation.

Methods

GetAnimation(String) GetAnimation(String) GetAnimation(String) GetAnimation(String)

Returns the animation with the specified key.

GetForCurrentView() GetForCurrentView() GetForCurrentView() GetForCurrentView()

Returns an instance of ConnectedAnimationService for the current view.

PrepareToAnimate(String, UIElement) PrepareToAnimate(String, UIElement) PrepareToAnimate(String, UIElement) PrepareToAnimate(String, UIElement)

Returns a connected animation that's associated with the specified key and source element.

See Also