【问题标题】:Built-in rotation animation of applicationbar in Windows PhoneWindows Phone 内置应用栏旋转动画
【发布时间】:2012-08-16 22:58:20
【问题描述】:

我的页面中有一个图片控件,支持横向和纵向布局。我想实现一个动画,当方向改变时旋转图像。这就像应用程序栏的内置旋转动画一样。但我现在没有任何想法。谁能帮我一把?

【问题讨论】:

    标签: windows-phone-7.1 windows-phone application-bar


    【解决方案1】:

    至少有两种实现方式:

    1) 使用 Expression Blend 中的 Fluid UI 功能捕捉 OrientationChanged 事件和动画布局。它允许您从一种视觉状态平滑过渡到另一种视觉状态。

     void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) {
            if(Orientation==PageOrientation.PortraitUp) {
                VisualStateManager.GoToState(this, "VisualStatePortrait", true);
            }
            else {
                VisualStateManager.GoToState(this, "VisualStateLandscape", true);
            }
        }
    

    您还应该为横向和纵向布局定义视觉状态。有关如何声明它们的更多信息,您可以从this 视频中找到。

    2) 来自 Microsoft 的 Windows Phone 开发人员的另一种方法introduced。他的解决方案需要额外的代码,但更可定制:您可以在旋转、淡入淡出或混合动画之间进行选择。还包括一个代码示例。

    【讨论】:

    • 是的,这就是我要找的。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-05
    • 1970-01-01
    相关资源
    最近更新 更多