views:

30

answers:

1

I have a Grid with 2 rows, where the second has Visibility.Collapsed by default. I want it to change to Visibility.Visible on MouseEnter on the Grid and back on MouseLeave. That's simple and done.

However, I would like the transition between Visible and Collapsed to not be instant but smooth.

I believe I can do this somehow with the VisualStateManager but I'm not sure how, so any guidance is appreciated.

A: 

You're looking for an animation. The easiest way to see how these work is to set one up in Microsoft's Expression Blend. Look at the resulting code and see what they did (it can be somewhat long, so only include the bare number of elements needed in your test stup).

Most likely, you'll end up using something other than just the Visibility property, since animations require numbers and the Visibility property has only discrete values. Animating both the Opacity and Height properties sounds about right.

John Fisher