How do you set the height of an object to Auto when Animating in WPF?
Posted
by discwiz
on Stack Overflow
See other posts from Stack Overflow
or by discwiz
Published on 2010-05-03T17:44:07Z
Indexed on
2010/05/03
17:48 UTC
Read the original article
Hit count: 267
Tring to animate the expanding and contracting of a WPF Expander in .Net 4.0 using PowerEase. The animation works except I have to hardcode the height or bind to the height of an object in the expander which does not give the desired height. I need to set the "To" of the expander to Auto in animation.
<Storyboard x:Name="myStoryboardContract" x:Key="myStoryboardContract">
<DoubleAnimation From="{Binding ElementName=MapsExpander, Path=ActualHeight}" To="30" Duration="00:00:3"
Storyboard.TargetName="MapsExpander"
Storyboard.TargetProperty="Height">
<DoubleAnimation.EasingFunction>
<PowerEase Power="20" EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</Expander.Resources>
<TextBlock x:Name="Text1" Text="Hi this is nothing but junk."/>
</Expander>
© Stack Overflow or respective owner