4

I'm trying to do an animation when navigating away from a page, but I get this error:

Cannot resolve TargetProperty (UIElement.RenderTransform).(CompositeTransform.TranslateX) on specified object.

I copied the code from a book, and I tested the book's sample code and it works but I can't get it to work on my app. Any ideas? This is my code:

XAML:

<phone:PhoneApplicationPage.Resources>
        <Storyboard x:Name="HidePage" Completed="HidePage_Completed">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="phoneApplicationPage">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="-480"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="phoneApplicationPage">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="-800"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
<phone:PhoneApplicationPage.Resources>

C#

protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
    base.OnNavigatingFrom(e);

    if (this.UriToNavigateTo == null)
    {
        e.Cancel = true;
        UriToNavigateTo = e.Uri;
        this.HidePage.Begin();
    }
    else
    {
        UriToNavigateTo = null;
    }
}

Thanks!

1
  • @lukas it's there now, thanks
    – Carlo
    Nov 13, 2010 at 8:09

2 Answers 2

6

The Silverlight toolkit at http://silverlight.codeplex.com/ now includes animations for Windows Phone 7 pages using the TransitionFrame control. You can read more about it here: Link

Basically, it works by setting your RootFrame to a TransitionFrame in App.xaml.cs:

RootFrame = new TransitionFrame();

And then setting navigation transitions for each page:

<toolkit:TransitionService.NavigationInTransition>
    <toolkit:NavigationInTransition>
        <toolkit:NavigationInTransition.Backward>
            <toolkit:TurnstileTransition Mode="BackwardIn"/>
        </toolkit:NavigationInTransition.Backward>
        <toolkit:NavigationInTransition.Forward>
            <toolkit:TurnstileTransition Mode="ForwardIn"/>
        </toolkit:NavigationInTransition.Forward>
    </toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
    <toolkit:NavigationOutTransition>
        <toolkit:NavigationOutTransition.Backward>
            <toolkit:TurnstileTransition Mode="BackwardOut"/>
        </toolkit:NavigationOutTransition.Backward>
        <toolkit:NavigationOutTransition.Forward>
            <toolkit:TurnstileTransition Mode="ForwardOut"/>
        </toolkit:NavigationOutTransition.Forward>
    </toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
2
  • Definitely will check it out. Thanks for the info!
    – Carlo
    Nov 15, 2010 at 21:34
  • I tried this, but it's not having any effect in the emulator. Aug 26, 2011 at 3:16
3

You forgot to set the CompositeTransform object, which define what kind of transform you are using.

<phone:PhoneApplicationPage.RenderTransform>
    <CompositeTransform/>
</phone:PhoneApplicationPage.RenderTransform>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.