public void PageEnter() { DoubleAnimation OpacityAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; ThicknessAnimation MarginAnimation = new ThicknessAnimation() { From = new Thickness( TitleGrid.Margin.Left - 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right + 50, TitleGrid.Margin.Bottom), To = TitleGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; MarginAnimation.Completed += delegate { ContentGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); ContentGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = new Thickness( ContentGrid.Margin.Left - 50, ContentGrid.Margin.Top, ContentGrid.Margin.Right + 50, ContentGrid.Margin.Bottom), To = ContentGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); }; TitleGrid.BeginAnimation(OpacityProperty, OpacityAnimation); TitleGrid.BeginAnimation(MarginProperty, MarginAnimation); }
public void PageEnter() { SkillListBox.ItemsSource = App.SkillList; SkillTargetConverter.AddSkillTarget += AddSkillTarget_Click; SkillProbability.Init(6, true); ContentViewer.Visibility = Visibility.Hidden; DoubleAnimation OpacityAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; ThicknessAnimation MarginAnimation = new ThicknessAnimation() { From = new Thickness( TitleGrid.Margin.Left - 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right + 50, TitleGrid.Margin.Bottom), To = TitleGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; MarginAnimation.Completed += delegate { SkillListGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = SkillListGrid.Margin, To = new Thickness(0, 100, 0, 0), Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); }; TitleGrid.BeginAnimation(OpacityProperty, OpacityAnimation); TitleGrid.BeginAnimation(MarginProperty, MarginAnimation); }
public void PageLeave() { if (ContentViewer.Visibility == Visibility.Visible) { ContentViewer.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); } var SkillListMarginAnimation = new ThicknessAnimation() { From = SkillListGrid.Margin, To = new Thickness(-300, 100, 0, 0), Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }; SkillListMarginAnimation.Completed += delegate { DispatcherTimer Timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.75) }; Timer.Tick += delegate { LeaveAction?.Invoke(); Timer.Stop(); }; TitleGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); TitleGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = TitleGrid.Margin, To = new Thickness( TitleGrid.Margin.Left + 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right - 50, TitleGrid.Margin.Bottom), Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); Timer.Start(); }; SkillListGrid.BeginAnimation(MarginProperty, SkillListMarginAnimation); }
public void PageLeave() { DoubleAnimation OpacityAnimation = new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }; ThicknessAnimation MarginAnimation = new ThicknessAnimation() { From = ContentGrid.Margin, To = new Thickness( ContentGrid.Margin.Left + 50, ContentGrid.Margin.Top, ContentGrid.Margin.Right - 50, ContentGrid.Margin.Bottom), Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }; MarginAnimation.Completed += delegate { DispatcherTimer Timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.5) }; Timer.Tick += delegate { DoubleAnimation FadeAnimation = new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(1), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }; FadeAnimation.Completed += delegate { LeaveAction?.Invoke(); }; this.BeginAnimation(OpacityProperty, FadeAnimation); Timer.Stop(); }; TitleGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); TitleGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = TitleGrid.Margin, To = new Thickness( TitleGrid.Margin.Left + 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right - 50, TitleGrid.Margin.Bottom), Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); Timer.Start(); }; ContentGrid.BeginAnimation(OpacityProperty, OpacityAnimation); ContentGrid.BeginAnimation(MarginProperty, MarginAnimation); }
public void PageEnter(Battlefield Battlefield) { this.Battlefield = Battlefield; for (int i = 0; i < ContentGrid.Children.Count; i++) { var NaviControl = new NavigationControl() { Index = i, Height = 10, Width = 10, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(-5 * ContentGrid.Children.Count - 2.5 * (ContentGrid.Children.Count - 1) + 15 * i, 0, 5 * ContentGrid.Children.Count + 2.5 * (ContentGrid.Children.Count - 1) - 15 * i, 0), RelatedGrid = ContentGrid.Children[i] as Grid }; NaviControl.SelectAction = delegate { if (NavigationGrid.Children.OfType <NavigationControl>().Any(O => O.IsSelected)) { var Before = NavigationGrid.Children.OfType <NavigationControl>().First(O => O.IsSelected); var After = NaviControl; var Timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) }; Timer.Tick += delegate { Before.RelatedGrid.Visibility = Visibility.Hidden; After.RelatedGrid.Visibility = Visibility.Visible; After.RelatedGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(1), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); After.RelatedGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = After.Index >= Before.Index ? new Thickness( After.RelatedGrid.Margin.Left - 100, After.RelatedGrid.Margin.Top, After.RelatedGrid.Margin.Right + 100, After.RelatedGrid.Margin.Bottom) : new Thickness( After.RelatedGrid.Margin.Left + 100, After.RelatedGrid.Margin.Top, After.RelatedGrid.Margin.Right - 100, After.RelatedGrid.Margin.Bottom), To = After.RelatedGrid.Margin, Duration = TimeSpan.FromSeconds(1), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }, }); Timer.Stop(); }; Before.RelatedGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(1), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); Before.RelatedGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = Before.RelatedGrid.Margin, To = After.Index >= Before.Index ? new Thickness( Before.RelatedGrid.Margin.Left + 100, Before.RelatedGrid.Margin.Top, Before.RelatedGrid.Margin.Right - 100, Before.RelatedGrid.Margin.Bottom) : new Thickness( Before.RelatedGrid.Margin.Left - 100, Before.RelatedGrid.Margin.Top, Before.RelatedGrid.Margin.Right + 100, Before.RelatedGrid.Margin.Bottom), Duration = TimeSpan.FromSeconds(1), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn }, FillBehavior = FillBehavior.Stop }); Timer.Start(); Before.Unselect(); } else { var After = NaviControl; After.RelatedGrid.Visibility = Visibility.Visible; After.RelatedGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(1), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); After.RelatedGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = new Thickness( After.RelatedGrid.Margin.Left - 100, After.RelatedGrid.Margin.Top, After.RelatedGrid.Margin.Right + 100, After.RelatedGrid.Margin.Bottom), To = After.RelatedGrid.Margin, Duration = TimeSpan.FromSeconds(1), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); } if (NavigationGrid.Children.OfType <NavigationControl>().All(O => O.IsViewed)) { ContinueButton.IsEnabled = true; } }; NavigationGrid.Children.Add(NaviControl); } WinnersDisplayPanel.Width = 150 * Battlefield.GetWinnerGroup().Participants.Length; Battlefield.GetWinnerGroup().Participants.ToList() .ForEach(O => { var TempControl = new ParticipantDisplayXLarge() { Height = 150, Width = 150, Opacity = 0 }; TempControl.Init(O); WinnersDisplayPanel.Children.Add(TempControl); }); Battlefield.SetStatisticsRatio(); PlayersListBox.ItemsSource = Battlefield.Room.Groups.SelectMany(O => O.Participants); PlayersListBox.SelectedIndex = 0; DoubleAnimation OpacityAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; ThicknessAnimation MarginAnimation = new ThicknessAnimation() { From = new Thickness( TitleGrid.Margin.Left - 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right + 50, TitleGrid.Margin.Bottom), To = TitleGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; MarginAnimation.Completed += delegate { DispatcherTimer Timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.75) }; Timer.Tick += delegate { ShowWinners(); Timer.Stop(); }; ContentGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); ContentGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = new Thickness( ContentGrid.Margin.Left - 50, ContentGrid.Margin.Top, ContentGrid.Margin.Right + 50, ContentGrid.Margin.Bottom), To = ContentGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); ((NavigationControl)NavigationGrid.Children[0]).Select(); Timer.Start(); }; TitleGrid.BeginAnimation(OpacityProperty, OpacityAnimation); TitleGrid.BeginAnimation(MarginProperty, MarginAnimation); }
public void PageEnter() { BattleTypeComboBox.Items.Add(new BattleTypeItem() { Height = 100, Width = 780, Image = { Source = Resources["OneVsOne"] as BitmapImage }, TypeText = { Text = "One Vs One" }, DescriptionText = { Text = "进行单独的一对一对决。" }, BattleType = BattleType.OneVsOne }); BattleTypeComboBox.Items.Add(new BattleTypeItem() { Height = 100, Width = 780, Image = { Source = Resources["TriangleMess"] as BitmapImage }, TypeText = { Text = "Triangle Mess" }, DescriptionText = { Text = "进行三角混战的骰子对战。" }, BattleType = BattleType.TriangleMess }); BattleTypeComboBox.Items.Add(new BattleTypeItem() { Height = 100, Width = 780, Image = { Source = Resources["SquareMess"] as BitmapImage }, TypeText = { Text = "Square Mess" }, DescriptionText = { Text = "进行四角混战的骰子对战。" }, BattleType = BattleType.SquareMess }); BattleTypeComboBox.Items.Add(new BattleTypeItem() { Height = 100, Width = 780, Image = { Source = Resources["TwinningFight"] as BitmapImage }, TypeText = { Text = "Twinning Fight" }, DescriptionText = { Text = "结成一个二人组与对方对抗。" }, BattleType = BattleType.TwinningFight }); DoubleAnimation OpacityAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; ThicknessAnimation MarginAnimation = new ThicknessAnimation() { From = new Thickness( TitleGrid.Margin.Left - 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right + 50, TitleGrid.Margin.Bottom), To = TitleGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; MarginAnimation.Completed += delegate { ContentGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); ContentGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = new Thickness( ContentGrid.Margin.Left - 50, ContentGrid.Margin.Top, ContentGrid.Margin.Right + 50, ContentGrid.Margin.Bottom), To = ContentGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); }; TitleGrid.BeginAnimation(OpacityProperty, OpacityAnimation); TitleGrid.BeginAnimation(MarginProperty, MarginAnimation); }
public void PageEnter() { DoubleAnimation OpacityAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; ThicknessAnimation MarginAnimation = new ThicknessAnimation() { From = new Thickness( TitleGrid.Margin.Left - 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right + 50, TitleGrid.Margin.Bottom), To = TitleGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; MarginAnimation.Completed += delegate { DispatcherTimer MenuTimer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.25) }; int Count = 0; MenuTimer.Tick += delegate { MenuList[Count].BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); MenuList[Count].BeginAnimation(MarginProperty, new ThicknessAnimation() { From = new Thickness( MenuList[Count].Margin.Left - 50, MenuList[Count].Margin.Top, MenuList[Count].Margin.Right, MenuList[Count].Margin.Bottom), To = MenuList[Count].Margin, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); Count++; if (Count >= MenuList.Count) { MenuTimer.Stop(); } }; MenuTimer.Start(); }; TitleGrid.BeginAnimation(OpacityProperty, OpacityAnimation); TitleGrid.BeginAnimation(MarginProperty, MarginAnimation); }
public void PageLeave() { DispatcherTimer MenuTimer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.25) }; int Count = 0; MenuTimer.Tick += delegate { MenuList[Count].BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); var MarginAnimation = new ThicknessAnimation() { From = MenuList[Count].Margin, To = new Thickness( MenuList[Count].Margin.Left + 50, MenuList[Count].Margin.Top, MenuList[Count].Margin.Right, MenuList[Count].Margin.Bottom), Duration = TimeSpan.FromSeconds(0.5), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }; if (Count == MenuList.Count - 1) { MarginAnimation.Completed += delegate { DispatcherTimer FinalTimer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(0.75) }; FinalTimer.Tick += delegate { LeaveAction?.Invoke(); FinalTimer.Stop(); }; TitleGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); TitleGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = TitleGrid.Margin, To = new Thickness( TitleGrid.Margin.Left + 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right - 50, TitleGrid.Margin.Bottom), Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseIn } }); FinalTimer.Start(); } } ; MenuList[Count].BeginAnimation(MarginProperty, MarginAnimation); Count++; if (Count >= MenuList.Count) { MenuTimer.Stop(); } }; MenuTimer.Start(); }
public void PageEnter(Room Target) { CurrentRoom = Target; if (CurrentRoom.IsHost(App.CurrentUser)) { App.Server.AcceptCompleted += ServerAccepted; } ChatWindow.Closing += HideSyncAction; RoomNameLabel.Content = Target.Name; BattleTypeLabel.Content = BattleTypeDictionary[Target.BattleType]; if (CurrentRoom.IsHost(App.CurrentUser)) { ChatWindow.Title = Target.Name; ChatWindow.CurrentRoom = CurrentRoom; HostNameBox.Text = Target.Host.Name; HostIntroBox.Text = Target.Host.Introduction; if (Target.Host.Avator != null) { using (MemoryStream Stream = new MemoryStream()) { Target.Host.Avator.Save(Stream, ImageFormat.Png); BitmapImage Temp = new BitmapImage(); Temp.BeginInit(); Temp.CacheOption = BitmapCacheOption.OnLoad; Temp.StreamSource = Stream; Temp.EndInit(); AvatorImage.ImageSource = Temp; } } DescriptionBlock.Text = Target.Description; GroupStack.Children.Clear(); foreach (var Group in Target.Groups) { var GroupItem = new Components.GroupItem(); GroupItem.JoinSyncAction = delegate(Player TargetUser) { foreach (var TempGroupItem in GroupStack.Children.OfType <Components.GroupItem>()) { foreach (var ParticipantItem in TempGroupItem.ParticipantStack.Children.OfType <ParticipantItem>()) { if ((ParticipantItem.Participant != null && ParticipantItem.Participant.Id != TargetUser.Id) || (CurrentRoom.Host.Id == App.CurrentUser.Id && ParticipantItem.Participant == null)) { ParticipantItem.ActionButton.Visibility = Visibility.Hidden; } else { ParticipantItem.ActionButton.Visibility = Visibility.Visible; } } } }; GroupItem.QuitSyncAction = delegate { foreach (var TempGroupItem in GroupStack.Children.OfType <Components.GroupItem>()) { foreach (var ParticipantItem in TempGroupItem.ParticipantStack.Children.OfType <ParticipantItem>()) { if (ParticipantItem.Participant == null || (ParticipantItem.Participant != null && CurrentRoom.Host.Id == App.CurrentUser.Id)) { ParticipantItem.ActionButton.Visibility = Visibility.Visible; } else { ParticipantItem.ActionButton.Visibility = Visibility.Hidden; } } } }; GroupItem.Init(Group, Target); GroupItem.Padding = new Thickness(0, 10, 0, 0); GroupStack.Children.Add(GroupItem); } } else if (App.Client["ReadyToReceive"] != null && (bool)App.Client["ReadyToReceive"]) { App.Client.Send(Encoding.UTF8.GetBytes("ReadyToReceive")); App.Client["ReadyToReceive"] = null; App.Client.ReceiveCompleted += BeginUpdateRoom; } else { App.Client.ReceiveCompleted += ReadyToUpdateRoom; } DoubleAnimation OpacityAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; ThicknessAnimation MarginAnimation = new ThicknessAnimation() { From = new Thickness( TitleGrid.Margin.Left - 50, TitleGrid.Margin.Top, TitleGrid.Margin.Right + 50, TitleGrid.Margin.Bottom), To = TitleGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }; MarginAnimation.Completed += delegate { if (CurrentRoom.IsHost(App.CurrentUser)) { ContentGrid.Visibility = Visibility.Visible; ContentGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); ContentGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = new Thickness( ContentGrid.Margin.Left - 50, ContentGrid.Margin.Top, ContentGrid.Margin.Right + 50, ContentGrid.Margin.Bottom), To = ContentGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); } else { WaitingGrid.Visibility = Visibility.Visible; WaitingGrid.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); WaitingGrid.BeginAnimation(MarginProperty, new ThicknessAnimation() { From = new Thickness( WaitingGrid.Margin.Left - 50, WaitingGrid.Margin.Top, WaitingGrid.Margin.Right + 50, WaitingGrid.Margin.Bottom), To = WaitingGrid.Margin, Duration = TimeSpan.FromSeconds(0.75), EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut } }); } }; TitleGrid.BeginAnimation(OpacityProperty, OpacityAnimation); TitleGrid.BeginAnimation(MarginProperty, MarginAnimation); }