private void animate8_Completed(object sender, EventArgs e) { Master wnd = (Master)Window.GetWindow(this); if (wnd != null) { mainPage nmp = (mainPage)wnd.mainFrame.Content; if (nmp != null) { animation.BeginAnimation(Ellipse.MarginProperty, null); } } ThicknessAnimation animate = new ThicknessAnimation(new Thickness(0), new Thickness(500, 0, -500, 0), TimeSpan.FromMilliseconds(300), FillBehavior.HoldEnd); animate.Completed += new EventHandler(animate1_Completed); ellipse_4.BeginAnimation(Ellipse.MarginProperty, animate); }