2015-04-20 45 views
-1
<Storyboard x:Key="CloseContentGrid"> 
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="ContentGrid"> 
     <EasingDoubleKeyFrame KeyTime="0" Value="100"/> 
     <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/> 
    </DoubleAnimationUsingKeyFrames> 
</Storyboard> 

我想從ActualHeight(100)改變Grid's HeightZero這個動畫如何在後面的代碼中編寫此XAML Storyboard?

回答

0

你可以試試這個:

DoubleAnimation animation = new DoubleAnimation(100,0, new Duration(TimeSpan.FromMilliseconds(800))); 
ContentGrid.BeginAnimation(HeightProperty, animation); 
+0

那麼容易:)謝謝 – Bulli