public void GetCloseAnimation() { Storyboard storyboard = new Storyboard(); Grid target = (popup.Child as Grid).Children[0] as Grid; storyboard.Completed += (s, args) => { if (popup.IsOpen) { SetApplicationBarVisibility(true); popup.IsOpen = false; msgBox = null; } }; DoubleAnimation animation = new DoubleAnimation() { Duration = TimeSpan.FromMilliseconds(100), From = SystemTray.IsVisible ? 30 : 0, To = -target.ActualHeight }; Storyboard.SetTarget(animation, target); Storyboard.SetTargetProperty(animation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)")); storyboard.Children.Add(animation); storyboard.Begin(); }
public static MyMessageBox CreateInstance() { if (null == msgBox) { msgBox = new MyMessageBox(); } return msgBox; }