I just want to start an storyboard which makes an rectangle visible for 2 seconds when user pressed with left mouse button. But I could not solve how to get the visibility value.
<Grid.Triggers>
<EventTrigger RoutedEvent="MouseDown" >
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="0:0:0" Duration="0:0:2" Storyboard.TargetName="RectFront" Storyboard.TargetProperty="Visibility">
<LinearDoubleKeyFrame KeyTime="0:0:0.100" Value="1" />
<LinearDoubleKeyFrame KeyTime="0:0:2" Value="0" /> <--- HOW to change this into Visibility Type?
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Grid.Triggers>
For example:
but in some cases the XAML parser can just convert a normal string like
Value="Hidden"as well.A problem here is though that to animate Visibility you cannot use a
DoubleAnimationUsingKeyFrames, it has to be anObjectAnimationUsingKeyFrames.If you want to animate visibility gradually you can use a
DoubleAnimation(with or without keyframes) but you need to target theOpacityinstead.