I have a small issue with my WPF application.
I have a splash image (as a XAML Window) and the main app (as another XAML window that gets caleld from Splash)
Even when I use this .Close() on Splash window and work on Main app, the Splash window is still visible in taskbar.
If I were to use this .Close on main app I would have two blank windows in taskbar application that I have to press X to close completely.
I've tried with Application.Current.Shutdown() as well but results were same.
Splash:
public Splash() { InitializeComponent(); } private void Window_ContentRendered(object sender, EventArgs e) { CloseProcedure(); } public async void CloseProcedure() { //Missing data loading which will be async. UC_Main UCMain = new UC_Main(); MainWindow window = new MainWindow(); window.AppContent.Children.Add(UCMain); this.Close(); await Task.Delay(500); //for fade effect. window.Show(); } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Closing -= Window_Closing; e.Cancel = true; var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(0.5)); this.BeginAnimation(UIElement.OpacityProperty, anim); anim.Completed += (s, _) => this.Close(); } Main App
private void BTN_Close_MouseUp(object sender, MouseButtonEventArgs e) { this.Close(); } private void titleBar_MouseDown(object sender, MouseButtonEventArgs e) { titleBar.Background = Brushes.White; } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Closing -= Window_Closing; e.Cancel = true; var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(0.2)); this.BeginAnimation(UIElement.OpacityProperty, anim); anim.Completed += (s, _) => Application.Current.Shutdown(); } }