WPF Trigger animation when Visibility is changed?
10,030
I tried this too and failed. I think it is not possible to accomplish this in a simple ControlTemplate
with a Trigger
on the Visibility
property. What you can do is add an Opacity
animation From 1 To 0 to a Trigger
for a different property, for instance a DependencyProperty
that you add in the code behind yourself.
Comments
-
Raven almost 2 years
Well i have a custom control and when
Visibility
is changed toVisible
I have aTrigger
with a enter/exit action but the problem is that when the exit action fires theVisibility
is no longerVisible
so the animation can't be seen how would I fix this?here is my
Trigger
:<ControlTemplate.Triggers> <Trigger Property="Visibility" Value="Visible"> <Trigger.ExitActions> <BeginStoryboard Storyboard="{StaticResource Hide}"/> </Trigger.ExitActions> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource Show}"/> </Trigger.EnterActions> </Trigger> </ControlTemplate.Triggers>