Windows Phone 7的导航动画 [英] Windows Phone 7 Navigation Animation
本文介绍了Windows Phone 7的导航动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图做从页面导航离开时的动画,但我得到这个错误:
I'm trying to do an animation when navigating away from a page, but I get this error:
指定对象上无法解析TargetProperty(UIElement.RenderTransform)。(CompositeTransform.TranslateX)。
Cannot resolve TargetProperty (UIElement.RenderTransform).(CompositeTransform.TranslateX) on specified object.
我复制了code从一本书,我测试了本书的样本code和它的作品,但我不能让它在我的应用程序工作。有任何想法吗?这是我的code:
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;
}
}
谢谢!
推荐答案
您忘了设置CompositeTransform对象,界定什么你正在使用一种变换。
You forgot to set the CompositeTransform object, which define what kind of transform you are using.
<phone:PhoneApplicationPage.RenderTransform>
<CompositeTransform/>
</phone:PhoneApplicationPage.RenderTransform>
这篇关于Windows Phone 7的导航动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文