microsoft / XamlBehaviors

This is the official home for UWP XAML Behaviors on GitHub.
MIT License
697 stars 112 forks source link

DataTriggerBehavior fires only first time #124

Open marco1orru opened 7 years ago

marco1orru commented 7 years ago

The request is that the row of my ListView blinks when the property SelectedItem of the ViewModel raises change.

This is my code, the problem is that it works only first time SelectedItem became true.

<DataTemplate x:Key="myDataTemplate">
    <Grid x:Name="myGrid">
        <Interactivity:Interaction.Behaviors>
            <Core:DataTriggerBehavior Binding="{Binding SelectedItem}" Value="True">
                <Media:ControlStoryboardAction>
                    <Media:ControlStoryboardAction.Storyboard>
                        <Storyboard>
                            <ColorAnimation
                                To="#009ABF" 
                                Storyboard.TargetName="myGrid" 
                                Storyboard.TargetProperty="(Grid.Background).(SolidColorBrush.Color)" 
                                AutoReverse="True" 
                                Duration="0:0:1"
                                RepeatBehavior="1x" />
                        </Storyboard>
                    </Media:ControlStoryboardAction.Storyboard>
                </Media:ControlStoryboardAction>
            </Core:DataTriggerBehavior>
        </Interactivity:Interaction.Behaviors>
        <!--OMISSIS-->
</Grid>

See detail here

pedrolamas commented 7 years ago

I've taken a quick look at the code you posted to stack overflow (as it is easier to read than the unformatted one on this issue) and there's not much to go with just that... can you provide a working sample app for the issue?