wp8 -- gameover

    <phone:PhoneApplicationPage.Resources>
        <Storyboard x:Name="Storyboard1">
            <DoubleAnimationUsingKeyFrames AutoReverse="True" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.LocalOffsetY)" Storyboard.TargetName="rectangle">
                <EasingDoubleKeyFrame KeyTime="0" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase EasingMode="EaseIn"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="50">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="stdShow">
            <DoubleAnimationUsingKeyFrames  
                        Storyboard.TargetName="trm"  
                        Storyboard.TargetProperty="Y"  
                        Duration="1">
                <EasingDoubleKeyFrame  
                            KeyTime="0:0:0" Value="180"/>
                <EasingDoubleKeyFrame  
                            KeyTime="0:0:1" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase Power="10"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="stdHide">
            <DoubleAnimationUsingKeyFrames  
                        Duration="0:0:1"  
                        Storyboard.TargetName="trm"  
                        Storyboard.TargetProperty="Y">
                <EasingDoubleKeyFrame KeyTime="0:0:0"  
                                              Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1"  
                                              Value="180">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase Power="10"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="tbShow">
            <DoubleAnimationUsingKeyFrames Duration="0:0:1" Storyboard.TargetName="Rota" Storyboard.TargetProperty="X">
                <EasingDoubleKeyFrame KeyTime="0:0:0" Value="-300"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="150">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase Power="4"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="tbHide">
            <DoubleAnimationUsingKeyFrames Duration="0:0:1" Storyboard.TargetName="Rota" Storyboard.TargetProperty="X">
                <EasingDoubleKeyFrame KeyTime="0:0:0" Value="300"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="-150">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase Power="4"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </phone:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid x:Name="rectangle" Background="Green" Margin="0,-50,0,607" Height="50" >
            <Grid.Projection>
                <PlaneProjection/>
            </Grid.Projection>
            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center">
                若要本地化显示的字符串
            </TextBlock>
        </Grid>
       
        <!--TitlePanel 包含应用程序的名称和页标题-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,471">
            <TextBlock Text="我的应用程序" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
            <TextBlock Text="页面名称" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - 在此处放置其他内容-->
        <Grid x:Name="ContentPanel" Margin="0,156,-10,10" Grid.RowSpan="3">
            <Button Width="150" Click="Button_Click_1" Margin="0,9,330,530"/>
            <Button Width="150" Click="Button_Click_2" Margin="0,94,330,445"/>
            <Button Width="150" Click="Button_Click_3" Margin="0,177,330,362" />
            
            <TextBox x:Name="tb" Visibility="Collapsed" Width="300" Height="90" HorizontalAlignment="Left">
                <TextBox.RenderTransform >
                    <TranslateTransform x:Name="Rota"/>
                </TextBox.RenderTransform>
            </TextBox>
            <Button Background="Green" Width="150" Click="Button_Click_4" Margin="0,269,330,270" />

            <StackPanel x:Name="sp" Background="LightBlue"  
                        Height="180"  
                        VerticalAlignment="Bottom" Margin="0,0,0,-12">
                <TextBlock Foreground="Red"   
                           Margin="20,20,20,20"  
                           FontSize="32"  
                           Text="你好,点击下面的按钮吧。"/>
                <StackPanel.RenderTransform>
                    <TranslateTransform x:Name="trm"  
                                        Y="180"/>
                </StackPanel.RenderTransform>
            </StackPanel>
        </Grid>
        
    </Grid>
       private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (Storyboard1.GetCurrentState() != ClockState.Stopped)
                Storyboard1.Stop();
            Storyboard1.Begin();

        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            if (stdHide.GetCurrentState() != ClockState.Stopped)
            {
                stdHide.Stop();
            }
            stdShow.Begin();  
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            if (stdShow.GetCurrentState() != ClockState.Stopped)
            {
                stdShow.Stop();
            }
            stdHide.Begin(); 
        }
        bool tbbool;
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            if (tbbool)
            {
                tbbool = false;
                if (tbShow.GetCurrentState() != ClockState.Stopped)
                {
                    tbShow.Stop();
                }
                tbHide.Begin();
                tbHide.Completed += tbHide_Completed;
            }
            else
            {
                tbbool = true;
                if (tbHide.GetCurrentState() != ClockState.Stopped)
                {
                    tbHide.Stop();
                }
                tbShow.Begin();
                tb.Visibility = Visibility.Visible;
            }
         
        }

        void tbHide_Completed(object sender, EventArgs e)
        {
            tb.Visibility = Visibility.Collapsed;
        }
原文地址:https://www.cnblogs.com/androllen/p/3280982.html