In win8 app I am trying small animation to make height of Rectangle 0
Properties like Opacity are working fine, but I am not able to bring animation in height or width.
<Page.Resources>
<Storyboard x:Name="NewStory">
<DoubleAnimation Storyboard.TargetName="MyRectangle" Storyboard.TargetProperty="Height" From="100" To="0" Duration="0:0:1" />
</Storyboard>
</Page.Resources>
<Rectangle Name="MyRectangle" Width="100" Height="100" Tapped="MyRectangle_OnTapped">
private void MyRectangle_OnTapped(object sender, TappedRoutedEventArgs e)
{
NewStory.Begin();
}
When you try to change something that influences layout then an animation for this change is called dependent animation, and it doesn't work by default. To be able to use it you should set EnableDependentAnimation property to true.
<Storyboard x:Name="NewStory">
<DoubleAnimation Storyboard.TargetName="MyRectangle" Storyboard.TargetProperty="Height" From="100" To="0" Duration="0:0:1" EnableDependentAnimation="true" />
</Storyboard>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With