private async void ViewDetails_Clicked(object sender, RoutedEventArgs e) { var senderTag = ((Button)sender).Tag.ToString(); var teamFifaCode = senderTag == "favorite" ? TeamOverviewViewModel.SelectedFavoriteTeam.FifaCode : TeamOverviewViewModel.SelectedOpposingTeam.FifaCode; var teamControl = new TeamUserControl(); var viewModel = await GetTeamViewModel(teamFifaCode); teamControl.SetDataContext(viewModel); PrepareAndShowAnimatedDialog(teamControl); }
private static void PrepareAndShowAnimatedDialog(TeamUserControl teamControl) { var dialog = new Window { Title = "Team", Content = teamControl, SizeToContent = SizeToContent.WidthAndHeight, WindowStartupLocation = WindowStartupLocation.CenterScreen }; dialog.WindowStyle = WindowStyle.None; dialog.AllowsTransparency = true; DoubleAnimation animFadeIn = new DoubleAnimation { From = 0, To = 1, Duration = new Duration(TimeSpan.FromSeconds(0.3)) }; dialog.BeginAnimation(Window.OpacityProperty, animFadeIn); dialog.ShowDialog(); }