1

アニメーションの停止に問題があり、永遠に続きます。RepeatBehavior がこれを制御する必要があると思いますが、機能していないようです。

<Grid.Style>
    <Style TargetType="Grid">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsNew}" Value="true">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation RepeatBehavior="1"
                                Storyboard.TargetProperty="Background.(SolidColorBrush.Color)"
                                To="LightGreen" Duration="0:0:0.25" AutoReverse="True" >
                            </ColorAnimation>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
            <DataTrigger Binding="{Binding IsNew}" Value="false">
                <Setter Property="Background" Value="WhiteSmoke"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</Grid.Style>
4

1 に答える 1

3

ソリューションは使用しています

RepeatBehavior="1x"

したがって、 1xは1だけではなく、私にとってはあまり論理的ではありませんが、おそらく理由があります..

更新 (@clemens からの入力後):

MSDN によると、XAML 属性の使用法は次のとおりです。

<object property="iterationCountx"/>
- or -
<object property="[days.]hours:minutes:seconds[.fractionalSeconds]"/>
- or -
<object property="[days.]hours:minutes"/>
- or -
<object property="days"/>
- or -
<object property="Forever"/>

それははるかに理にかなっていますが、あまり直感的ではありません..

<Grid.Style>
    <Style TargetType="Grid">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsNew}" Value="true">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation RepeatBehavior="1x"
                                Storyboard.TargetProperty="Background.(SolidColorBrush.Color)"
                                To="LightGreen" Duration="0:0:0.25" AutoReverse="True" >
                            </ColorAnimation>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
            <DataTrigger Binding="{Binding IsNew}" Value="false">
                <Setter Property="Background" Value="WhiteSmoke"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</Grid.Style>
于 2013-10-15T12:42:36.757 に答える