Brandon
Brandon

Reputation: 6872

How to animate visibility of a StackPanel in Silverlight to expand and collapse?

In my case, I would like the expand/collapse to happen from left to right and right to left respectively.

The animation should happen when the visibility changes.

Thank you.

Upvotes: 0

Views: 1656

Answers (2)

AlvinfromDiaspar
AlvinfromDiaspar

Reputation: 6814

I recommend animating on the Width property rather than ScaleX. Otherwise the entire control (StackPanel) will look crunched/stretched as its animating.

Upvotes: 0

Rachel
Rachel

Reputation: 132548

You could create two animation storyboards (One for expanding and one for Collapsing) that animates the Width of the stackpanel, then on StackPanel_VisibilityChanged run the appropriate animation.

Upvotes: 1

Related Questions