ChildWindow在Open时旋转出现
生活随笔
收集整理的這篇文章主要介紹了
ChildWindow在Open时旋转出现
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在App.xaml中:
<VisualState x:Name="Open"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="ContentRoot"> <EasingDoubleKeyFrame KeyTime="0" Value="90"/> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualState>其次,在<Grid x:Name="ContentRoot"...> 中加入:
<Grid.Projection><PlaneProjection/> </Grid.Projection>?下面是兩個窗口翻轉出現的例子:A窗口在前為調用窗口,B窗口在后為被調用窗口。
A窗口在app.xaml中的樣式:
<VisualStateGroup x:Name="AnimationStates"><VisualState x:Name="WindowShow"><Storyboard><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="ContentRoot"><EasingDoubleKeyFrame KeyTime="0" Value="-90"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-90"/><EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/></DoubleAnimationUsingKeyFrames></Storyboard></VisualState><VisualState x:Name="WindowHide"><Storyboard><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="ContentRoot"><EasingDoubleKeyFrame KeyTime="0" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="90"/></DoubleAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup>B窗口在app.xaml中的樣式:
<VisualStateGroup x:Name="WindowStates"><VisualState x:Name="Open"><Storyboard><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="ContentRoot"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="-90"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-90"/><EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/></DoubleAnimationUsingKeyFrames></Storyboard></VisualState><VisualState x:Name="Closed"><Storyboard><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="ContentRoot"><EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="90"/></DoubleAnimationUsingKeyFrames></Storyboard></VisualState></VisualStateGroup>A窗口中某一個按鈕的代碼:
private void button1_Click(object sender, RoutedEventArgs e){VisualStateManager.GoToState(this, "WindowHide", true);WinB w = new WinB();w.Show();w.Closed += new EventHandler(w_Closed);}void w_Closed(object sender, EventArgs e){VisualStateManager.GoToState(this, "WindowShow", true);}?另外,RotationY的值為:
0:向前;
180:向后;
90:向左;
-90:向右。
?
?
轉載于:https://www.cnblogs.com/ajeeky/archive/2013/02/17/2915033.html
總結
以上是生活随笔為你收集整理的ChildWindow在Open时旋转出现的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 对 带头结点的单链表 的操作
- 下一篇: 301跳转的实现