アニメーションチュートリアル(動的登録/静的登録)
4975 ワード
1 // StoryBoard
2 Storyboard storyBoard = new Storyboard();
3 //
4 DoubleAnimation doubleAnimationY = new DoubleAnimation();
5 //
6 doubleAnimationY.Duration = new Duration(TimeSpan.FromMilliseconds(500));
7 //
8 doubleAnimationY.To = 0;
9 //
10 Storyboard.SetTarget(doubleAnimationY, this.Sale(“ , ”));
11 //
12 Storyboard.SetTargetProperty(doubleAnimationY, new PropertyPath("Height( , )"));
13 //
14 storyBoard.Children.Add(doubleAnimationY);
15 //
16 storyBoard.Begin();
静的登録
1 <UserControl>
2 <UserControl.Resources>
3 <Storyboard x:Name="SlideOut">
4 <DoubleAnimation Storyboard.TargetName="Slide" Storyboard.TargetProperty=" Storyboard.TargetName " Duration="00:00:00.50" To="200"/>
5 </Storyboard>
6 <Storyboard x:Name="SlideIn">
7 <DoubleAnimation Storyboard.TargetName="Slide" Storyboard.TargetProperty=" Storyboard.TargetName " Duration="00:00:00.50" To="0"/>
8 </Storyboard>
9 </UserControl.Resources>
10 </UserControl>
11
12 SlideIn.Begin();