Question

I have the following Data Trigger set-up on a Control Template

<DataTrigger Binding="{Binding Path=IsDragged}"
             Value="True">
    <DataTrigger.EnterActions>
        <BeginStoryboard Storyboard="{StaticResource Active}" />
    </DataTrigger.EnterActions>
    <DataTrigger.ExitActions>
        <BeginStoryboard Storyboard="{StaticResource Unactive}" />
    </DataTrigger.ExitActions>
</DataTrigger>

Generally it will fire at least once (not always) and at some point will cease. Some additional interesting notes:

  • The same property is set-up in a MultiDataTrigger, this trigger will always fire
  • The same storyboards are referenced in another trigger, they continue to run after this trigger fails

Edit: The MultiDataTriggers is set-up as follows:

<MultiDataTrigger>
    <MultiDataTrigger.Conditions>
        <Condition Binding="{Binding Path=IsActive}"
                   Value="True" />
        <Condition Binding="{Binding Path=IsDragged}"
                   Value="False" />
        <Condition Binding="{Binding Path=IsInCart}"
                   Value="False" />
    </MultiDataTrigger.Conditions>
    <MultiDataTrigger.EnterActions>
        <BeginStoryboard x:Name="ShowTag_BeginStoryboard"
                         Storyboard="{StaticResource ShowTag}" />
    </MultiDataTrigger.EnterActions>
    <MultiDataTrigger.ExitActions>
        <BeginStoryboard x:Name="HideTag_BeginStoryboard"
                         Storyboard="{StaticResource HideTag}" />
    </MultiDataTrigger.ExitActions>
</MultiDataTrigger>
Was it helpful?

Solution

Just an educated guess, but I've run into something like this before and it turned out that I needed to stop each storyboard before I started another one, because they were conflicting with each other.

Try adding two StopStoryboard actions to your DataTrigger, one to stop the Active storyboard and the other to stop the Unactive storyboard.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top