How do you set the height of an object to Auto when Animating in WPF?
- by discwiz
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>