【问题标题】:Windows Phone 7 Navigation AnimationWindows Phone 7 导航动画
【发布时间】: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 它现在在那里,谢谢

标签: animation windows-phone-7


【解决方案1】:

http://silverlight.codeplex.com/ 的 Silverlight 工具包现在包括使用 TransitionFrame 控件的 Windows Phone 7 页面动画。你可以在这里阅读更多信息:Link

基本上,它通过将您的 RootFrame 设置为 App.xaml.cs 中的 TransitionFrame 来工作:

RootFrame = new TransitionFrame();

然后为每个页面设置导航过渡:

【讨论】:

  • 一定会检查出来的。感谢您的信息!
  • 我试过了,但在模拟器中没有任何效果。
【解决方案2】:

您忘记设置 CompositeTransform 对象,它定义了您使用的变换类型。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 2012-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多