Reputation: 12710
For instance I am setting the Visibility on and off for a certain element. I have a Trigger that listens to the Visibility being set to Visible and plays out a Storyboard that fades in the element.
So on the flip side, when the element is set to Hidden, I want the element to fade out, and then have the property set to Visibility = false. Is this possible and if so how? Currently I have something like:
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
Upvotes: 3
Views: 356
Reputation: 27055
There are more Trigger classes that meet the eye.. Perhaps you can use another trigger to achieve what you wish to do..
From MSDN:
There are several different types of triggers: Trigger, MultiTrigger, EventTrigger, DataTrigger, and MultiDataTrigger.
Perhaps use a DataTrigger to bind to a state property that tells the UI something is changing? Or you can try using a custom event and an EventTrigger to achieve the same? Just some thoughts..
Upvotes: 2