Windows Phone 8.1 类似 Bing 的幻灯片页面动画 [英] Windows Phone 8.1 Bing-like slide page animation

查看:26
本文介绍了Windows Phone 8.1 类似 Bing 的幻灯片页面动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 Windows Phone 8.1 应用程序中添加一个页面转换,以便下一页将从屏幕底部滑入.当您通过点击搜索按钮启动 Bing 时,会使用类似的效果.

I'd like to add a page transition in my Windows Phone 8.1 app in such a way, that the following page will slide-in from the bottom of the screen. Similar effect is used when you launch Bing by hitting the Search button.

不幸的是,MSDN 对该主题的描述并不多.有谁知道如何实现这样的动画?

Unfortunately, the MSDN isn't much descriptive on that topic. Does anyone know how to implement such an animation?

推荐答案

首先,您必须禁用 Frame 的当前过渡 - 最好的位置是 App.xaml.cs 创建 rootframe 的位置,但这取决于您的应用程序的初始化方式.例如,在 MainPage 构造函数中:

First you will have to disable current Transitions for the Frame - the best place would be in App.xaml.cs where the rootframe is created but it depends on how your App is initialized. Here for example is in MainPage constructor:

public MainPage()
{
    this.InitializeComponent();
    Frame mainFrame = Window.Current.Content as Frame;
    mainFrame.ContentTransitions = null;
}

禁用默认过渡后,您可以在每个Page 中定义自己的过渡:

After you have disabled default Transitions, in every Page you can define its own Transition:

Page.xaml 中:

<Page.Transitions>
    <TransitionCollection>
       <PaneThemeTransition Edge="Bottom"/>          
    </TransitionCollection>
</Page.Transitions>

我不确定这是否正是您要寻找的动画.有关动画的更多信息,您可以在这里在 MSDN.

I'm not sure if that is the exact animation you were looking for. More about animations you will find here at MSDN.

当然,您也可以定义 Frame 的新 ContentTransitions,以便它们作为所有 Pages 的默认值 - 例如:

Of course you can also define Frame's new ContentTransitions, so that they would be as default for all Pages - for example:

// instead of null put in MainPage constructor:
mainFrame.ContentTransitions = new TransitionCollection { new PaneThemeTransition { Edge = EdgeTransitionLocation.Bottom } };

这篇关于Windows Phone 8.1 类似 Bing 的幻灯片页面动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆