1
불투명도 특성을 올바르게 설정할 수는 있지만 Storyboard
에 바인딩하지 않으면 나중에 설정할 수 있습니다.Storyboard Animation이 이미 설정 한 컨트롤에 불투명도를 직접 설정하십시오.
UserControl MyControl;
MyControl.Opacity = 0.8; /// This works before animation set
Storyboard sb = new Storyboard();
DoubleAnimation opacity = new DoubleAnimation();
opacity.From = 1;
opacity.To = 0;
opacity.Duration = TimeSpan.FromMilliseconds(400);
Storyboard.SetTarget(opacity, MyControl);
Storyboard.SetTargetProperty(opacity, new PropertyPath(UserControl.OpacityProperty));
sb.Children.Add(opacity);
sb.Begin();
sb.Completed += (object sender, EventArgs e) => {
MyControl.Opacity = 0.5; /// This doesn't work anymore
}
Storyboard
이 완료된 후 어떻게 작동합니까?
How to: Set a Property After Animating It with a Storyboard을 설명한다. 왜 내가'MyControl'을'Storyboard'에 직접 추가하지 않는 동안 컨트롤을'Remove '할 수 있습니까? – Val
멋진 기사 인'FillBehavior = FillBehavior.Stop'이 저에게 효과적입니다. 고맙습니다! – Val
@Val 당신을 환영합니다 –