Tell SplashScreen that MainWindow is its parent window. When a child window loses focus, its parent gains focus. If there is no parent, the window manager decides.
splashScreen.Show (MainWindow); Strike>
EDIT
I just found out that there is a SplashScreen class. It looks like you are using this class, not just the regular form, as I assumed.
So, I just made a simple WPF application with SplashScreen, and for me the mentioned effect did not happen. The main window has not lost focus.
I would suggest you comment on the potions of your application initialization code until the blinking stops. Then you have a starting point for further research on why the focus is lost.
EDIT2
Not knowing my code, I tried to reproduce this phenomenon, and it was not too difficult. No matter what I tried, a change in focus always occurred when the main window was already shown and had focus.
So, the best solution that I see is to manually show the main window after , calling the Spl () splash screen method:
Remove StartupUri from App.xaml
Show SplashScreen after starting the application and initializing resources. After a (fixed) delay, close SplashScreen and show the main window:
public partial class App : Application { const int FADEOUT_DELAY = 2000; SplashScreen splash = new SplashScreen("splash.jpg"); protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); splash.Show(false, true); var worker = new BackgroundWorker(); worker.DoWork += (sender, ea) => { Thread.Sleep(1000); splash.Close(new TimeSpan(0, 0, 0, 0, FADEOUT_DELAY));
Vvs source share