[ストアアプリ][入門] Step44. アニメーション3 ~繰り返し再生数の設定~

スポンサーリンク

今回は繰り返し再生数を設定してみましょう。

前回の記事に少し修正を加えていきます。

繰り返し再生数を設定するには、StoryBord要素のRepeatBehavior属性に繰り返し数を設定します。

以下は、繰り返し数を5回に設定する例です。アニメーション時間は1秒に設定しています。

XAMLの例

<Page
    x:Class="Step23.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Step23"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" Loaded="Page_Loaded">

    <Page.Resources>
        <Storyboard x:Key="storyBoard">
            <DoubleAnimation Storyboard.TargetName="txbFont"
                             Storyboard.TargetProperty="FontSize"
                             EnableDependentAnimation="True"
                             From="10" To="50" 
                             Duration="0:0:1"
                             RepeatBehavior="5x"/>
        </Storyboard>
    </Page.Resources>
    
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <TextBlock x:Name="txbFont" HorizontalAlignment="Left" Margin="103,97,0,0" 
                   TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
        <Button Content="Button" HorizontalAlignment="Left" Margin="100,48,0,0" VerticalAlignment="Top" Click="Button_Click"/>
    </Grid>
</Page>

 

Please follow and like us:

コメント

  1. […] ← 前へ […]

タイトルとURLをコピーしました