Animate control in: use correct height
I have a Button and a UserControl. The height of the UserControl is set to 0. When I click the Button I use a StoryBoard to animate the height of the UserControl to 100. The UserControl becomes visible. Works fine.
But now I want to get rid of the fixed value of 100 and animate to the size that the UserControl would normally occupy. Any suggestions on how to do this?
Here's my StoryBoard.
<Storyboard x:Key="animateIn">
<DoubleAnimation To="100" Storyboard.TargetName="myControl" 开发者_如何学JAVAStoryboard.TargetProperty="Height" Duration="0:0:0.1" />
</Storyboard>
Animate ScaleTransform.ScaleY
instead.
<UserControl x:Name="myControl">
<UserControl.LayoutTransform>
<ScaleTransform ScaleY="0" />
</UserControl.LayoutTransform>
</UserControl>
<Storyboard x:Key="animateIn">
<DoubleAnimation To="1"
Storyboard.TargetName="myControl"
Storyboard.TargetProperty="LayoutTransform.(ScaleTransform.ScaleY)"
Duration="0:0:0.1" />
</Storyboard>
精彩评论