에니메이션 끝날때 이벤트 추가하기 - Changing FillBehaviour at animation end.
WPF 2007. 9. 20. 03:35 |xaml 코드에서 Completed="OnCompleted" 를 사용해서 에니메이션이 완료 되었을때 처리코드를 추가 할 수 있다.
<Window.Resources>
<Storyboard x:Key="sb1" Completed="OnCompleted">
<DoubleAnimation Storyboard.TargetName="deactiveAnimationRectangle" Storyboard.TargetProperty="Width" From="20" To="400" Duration="0:0:5" />
<DoubleAnimation Storyboard.TargetName="holdEndAnimationRectangle" Storyboard.TargetProperty="Width" From="10" To="400" Duration="0:0:1.5" BeginTime="0:0:0.5"/>
</Storyboard>
</Window.Resources>
Being able, when animation ended, to set rectangle Width using: holdEndAnimationRectangle.Width = 250;
Also tried:
void
OnCompleted (object sender, EventArgs e){
Storyboard sb = (Storyboard)this.FindResource("sb1");
sb.FillBehavior = FillBehavior.Stop;
holdEndAnimationRectangle.Width = 250;
}