【发布时间】:2022-02-17 17:08:02
【问题描述】:
我在离开页面时尝试制作动画,但出现此错误:
无法解析指定对象上的 TargetProperty (UIElement.RenderTransform).(CompositeTransform.TranslateX)。
我从一本书中复制了代码,并测试了这本书的示例代码,它可以运行,但我无法让它在我的应用程序上运行。有任何想法吗?这是我的代码:
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;
}
}
谢谢!
【问题讨论】:
-
@lukas 它现在在那里,谢谢