1

次のコードがあります。

<Storyboard x:Key="CounterStoryboard" >

    <!-- Panel appear -->
    <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetName="CounterPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
        <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}"/>
    </ObjectAnimationUsingKeyFrames>

    <!-- 3-->
    <DoubleAnimation 
        Storyboard.TargetProperty="(UIElement.Opacity)" 
        Storyboard.TargetName="CounterLabel3" From="1" To="0" Duration="0:0:1" BeginTime="0:0:0">
    </DoubleAnimation>

    <!-- 2 -->
    <DoubleAnimation 
        Storyboard.TargetProperty="(UIElement.Opacity)" 
        Storyboard.TargetName="CounterLabel2" From="0" To="1" Duration="0:0:0" BeginTime="0:0:1">
    </DoubleAnimation>
    <DoubleAnimation 
        Storyboard.TargetProperty="(UIElement.Opacity)" 
        Storyboard.TargetName="CounterLabel2" From="1" To="0" Duration="0:0:1" BeginTime="0:0:1">
    </DoubleAnimation>

    <!-- 1 -->
    <DoubleAnimation 
        Storyboard.TargetProperty="(UIElement.Opacity)" 
        Storyboard.TargetName="CounterLabel1" From="0" To="1" Duration="0:0:0" BeginTime="0:0:2">
    </DoubleAnimation>
    <DoubleAnimation 
        Storyboard.TargetProperty="(UIElement.Opacity)" 
        Storyboard.TargetName="CounterLabel1" From="1" To="0" Duration="0:0:1" BeginTime="0:0:2">
    </DoubleAnimation>

    <!-- Panel disappear -->
    <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetName="CounterPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
        <DiscreteObjectKeyFrame KeyTime="0:0:3" Value="{x:Static Visibility.Collapsed}"/>
    </ObjectAnimationUsingKeyFrames>
</Storyboard>

これは、3 から 1 までのカウンターのように機能します。最後の部分を除いて、すべて正常に動作します。が機能していPanel disappearません。パネルを非表示にする必要がありますが、まだそこにあります...

私が間違っていることは何ですか?

注:ストーリーボードを次のように呼び出します。

sb = (Storyboard)FindResource("CounterStoryboard");
sb = sb.Clone();
sb.Completed += sb_Completed;
sb.Begin(this);
4

1 に答える 1