Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 在Windows Phone 7中将控件从纵向平滑旋转到横向_Windows Phone 7_Expression Blend - Fatal编程技术网

Windows phone 7 在Windows Phone 7中将控件从纵向平滑旋转到横向

Windows phone 7 在Windows Phone 7中将控件从纵向平滑旋转到横向,windows-phone-7,expression-blend,Windows Phone 7,Expression Blend,我正在显示一个画布,希望它在手机从纵向旋转到横向时能够平稳地旋转90度 似乎当手机旋转时(至少在模拟器中),画布会自动旋转,但过渡不是平滑的(即从0度到90度)-我假设这是自动布局功能 我希望画布能够平稳旋转,即不会突然从0度跳到90度(就像自动布局功能那样)。我在状态管理器中设置了两个状态,并调用以下命令: private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEven

我正在显示一个画布,希望它在手机从纵向旋转到横向时能够平稳地旋转90度

似乎当手机旋转时(至少在模拟器中),画布会自动旋转,但过渡不是平滑的(即从0度到90度)-我假设这是自动布局功能

我希望画布能够平稳旋转,即不会突然从0度跳到90度(就像自动布局功能那样)。我在状态管理器中设置了两个状态,并调用以下命令:

    private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
    {
        if ((e.Orientation & PageOrientation.Landscape) != 0)
        {
            VisualStateManager.GoToState(this, "Landscape", true);
        }
        else
        {
            VisualStateManager.GoToState(this, "Portrait", true);
        }
   }
我已按如下方式设置了这些之间的转换:

<VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="OrientationStates">
        <VisualStateGroup.Transitions>
            <VisualTransition From="Portrait" GeneratedDuration="0" To="Landscape">
                <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="LayoutRoot">
                        <EasingDoubleKeyFrame KeyTime="0" Value="90"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </VisualTransition>
            <VisualTransition From="Landscape" GeneratedDuration="0" To="Portrait">
                                        <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="LayoutRoot">
                        <EasingDoubleKeyFrame KeyTime="0" Value="90"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </VisualTransition>
        </VisualStateGroup.Transitions>
        <VisualState x:Name="Portrait"/>
        <VisualState x:Name="Landscape"/>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

有趣的是,过渡应该从90度开始,然后旋转回0,因为自动布局功能似乎首先开始。这是我应该做的吗

或者如何覆盖自动布局功能,以便首先触发过渡


我只在emulator中工作(等待漫长的AppHub注册过程),因此很难确定这是否是正确的方法

您可能对David Anson在这里实现的这种效果感兴趣:


它完全是开源的。

VisualState有一个选项
流体动画
。谷歌it…@Ku6opr-这种评论没有建设性。链接到“流体动画”选项如何?此选项是DependencyProperty还是Blend中的某个UI元素?它是Expression Blend中“视觉状态”面板右上角的一个按钮。