Main window doesn't get focus

3 posts, 0 answers
  1. Emilio
    Emilio avatar
    7 posts
    Member since:
    Oct 2013

    Posted 18 Feb Link to this post

    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. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    567 posts

    Posted 19 Feb Link to this post

    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.
  3. Emilio
    Emilio avatar
    7 posts
    Member since:
    Oct 2013

    Posted 21 Feb in reply to Vladimir Stoyanov Link to this post

    This worked perfectly. Thanks, Vladimir.
Back to Top