This is a migrated thread and some comments may be shown as answers.

Main window doesn't get focus

2 Answers 743 Views
SplashScreen
This is a migrated thread and some comments may be shown as answers.
Emilio
Top achievements
Rank 1
Emilio asked on 19 Feb 2020, 03:27 AM

Hello,

When I use a RadSplashScreen at the launch of my application, the application's main window doesn't receive focus and appears behind other windows. I've seen a reference to this type of behavior on another thread regarding RadWindow (https://www.telerik.com/forums/mainwindow-losts-focus-after-child-radwindow-is-closed), but the solution there doesn't seem applicable to this control.

I created a sample application (https://github.com/3milio/RadSplashScreenHidingMainWindow) with VS 2017 following your getting started guide. Mind trying it out and seeing if I'm missing a step? For me, when I hit F5 in the debugger to run it the splash screen appears on top of it but then when the main window gets instantiated it hides behind other programs.

Also, when I first cloned the repo and ran it in the debugger it didn't demonstrate this behavior. But any time after that, it did. That includes running it with the Release configuration, as well as simply running the .exe from Windows Explorer.

Thanks,

Emilio

2 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 19 Feb 2020, 01:27 PM

Hello Emilio,

Thank you for the referenced sample. 

What I can suggest for the described scenario is to activate the MainWindow when it is Loaded. Here is what I have in mind:

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            this.Loaded += (s, e) => this.Activate();
        }
    }

Do give this a try and let me know how it goes.

Regards,
Vladimir Stoyanov
Progress Telerik

Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Emilio
Top achievements
Rank 1
answered on 22 Feb 2020, 03:19 AM
This worked perfectly. Thanks, Vladimir.
Tags
SplashScreen
Asked by
Emilio
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Emilio
Top achievements
Rank 1
Share this question
or