キャンバスを表示していて、電話機をポートレートからランドスケープに回転させたときに、90度までスムーズに回転します。Windows Phone 7で、ポートレートから風景にスムーズに回転します。
携帯電話を回転させると(少なくともエミュレータ内では)キャンバスは自動的に回転しますが、スムーズなものではありません(つまり、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に戻します。これは私がやるべきことですか?
または、トランジションが最初にトリガーされるように自動レイアウト機能を無効にするにはどうすればよいですか?
私はエミュレータ(長いアプリケーションハブ登録プロセスを待っている)で作業しているので、これが正しい方法であるかどうかを確認するのは難しいです。
VisualStateには、「フルイドアニメーション」オプションがあります。 Googleはそれを... – Ku6opr
@ Ku6opr - そのようなコメントは建設的ではありません。 "Fluid Animation"オプションへのリンクはどうですか?このオプションはDependencyPropertyかBlendのいくつかのUI要素ですか? –
Expression BlendのVisual Statesパネルの右上にあるボタンです。 http://www.microsoft.com/design/toolbox/tutorials/windows-phone-7/layout-tips/#FluidUI – Ku6opr