1

私は次のxamlを持っています

<DataGrid Name ="TheGrid" Margin="0,21,0,0" DataContext ="{Binding StreamItems}"    ItemsSource="{Binding}" CanUserReorderColumns="True" CanUserResizeColumns="True" 
      CanUserResizeRows="False" CanUserSortColumns="True" AutoGenerateColumns="False" RowHeight="21">
        <DataGrid.Resources>
            <Style TargetType="DataGridCell" x:Key="FlashStyle">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding CurrentState}" Value="Idle" >
                        <DataTrigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard x:Name="BlinkIdle" >
                                    <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)">
                                        <DiscreteColorKeyFrame Value="DarkOrchid" KeyTime="0:0:0" />
                                        <DiscreteColorKeyFrame Value="DarkOrchid" KeyTime="0:0:5" />
                                        <LinearColorKeyFrame Value="Transparent" KeyTime="0:0:8" />
                                    </ColorAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </DataTrigger.EnterActions>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding CurrentState}" Value="Streaming" >
                        <DataTrigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard x:Name="BlinkStreaming">
                                    <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)">
                                        <DiscreteColorKeyFrame Value="DarkGreen" KeyTime="0:0:0" />
                                        <DiscreteColorKeyFrame Value="DarkGreen" KeyTime="0:0:5" />
                                        <LinearColorKeyFrame Value="Transparent" KeyTime="0:0:8" />
                                    </ColorAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </DataTrigger.EnterActions>
                    </DataTrigger>
              </Style.Triggers>
            </Style>
        </DataGrid.Resources>

私が抱えている問題は、スクロールするとき、またはユーザーが列を並べ替えるときに、アニメーションがトリガーされることです。データが変更されたときにアニメーションを 1 回だけトリガーするようにするにはどうすればよいですか?

4

0 に答える 0