public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Opacity = 0; FadeIn(); } private void Window_Closing(object sender, CancelEventArgs e) { Closing -= Window_Closing; e.Cancel = true; DoubleAnimation fadeOut = new DoubleAnimation(0, TimeSpan.FromMilliseconds(350)); fadeOut.Completed += (s, _) => Close(); BeginAnimation(OpacityProperty, fadeOut); } private void FadeIn() { DoubleAnimation fadeIn = new DoubleAnimation(1, TimeSpan.FromMilliseconds(250)); DoubleAnimation scaleWidth = new DoubleAnimation(Width * 1.1, TimeSpan.FromMilliseconds(350)); DoubleAnimation scaleHeight = new DoubleAnimation(Height * 1.1, TimeSpan.FromMilliseconds(350)); BeginAnimation(OpacityProperty, fadeIn); BeginAnimation(WidthProperty, scaleWidth); BeginAnimation(HeightProperty, scaleHeight); } }
Animation follows each other, and how to perform it simultaneously? Tried threads, but cannot access GUI.
Loadedevent happens - Andrey NOP