MainWindow "losts" focus after child RadWindow is closed

12 posts, 0 answers
  1. Zoltan
    Zoltan avatar
    7 posts
    Member since:
    Feb 2012

    Posted 24 Mar 2012 Link to this post


    I have a standard WPF MainWindow, from that I open a modal RadWindow (using .ShowDialog()). When the user clicks on one button I close the dialog and open a new non-modal RadWindow:

    ConfigurationComparerWindow comparerWindow = new ConfigurationComparerWindow() { Owner = Application.Current.MainWindow, };
    //comparerWindow.Closed += (s, a) => { Application.Current.MainWindow.Focus(); };

    This works just fine.

    But if the user closes the second window I would expect that the MainWindow receives the focus. Instead the MainWindow is sent to back. If I uncomment the Closed event handler it works as I expected.

    What is the preferred way of doing this?

  2. Yana
    Yana avatar
    4654 posts

    Posted 28 Mar 2012 Link to this post

    Hello Zoltan,

    This seems a bug in RadWindow for WPF which we will investigate and try to fix. For now, please use the workaround with Closed event handler - we've tested it and it worked as expected at our side as well.

    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 26 Jun 2012 Link to this post


    I think I'm facing the same kind of situation, we have a MainWindow, from this main Window, we call the RadWindows, but sometimes, when we close the RadWindow, the App "lost" it's focus and the previous opened application show.


    Step 1: Programming in VS
    Step 2: Start App
    Step 3: Open RadWindow from App
    Step 4: Close RadWindow
    Step 5: Instead going back to the APP the "focus" goes to VS.

    We thought this is some kind of VS bug, but when we put the App in production, the same behavior happened. Is there some kind of Know bug?

  4. Joao Paulo Grassi
    Joao Paulo Grassi avatar
    98 posts
    Member since:
    Feb 2011

    Posted 26 Jun 2012 Link to this post

    Searching on the internet I found this: 

    Seems that this is a "know" WPF problem.
  5. Charles
    Charles avatar
    41 posts
    Member since:
    Mar 2012

    Posted 28 Jul 2012 Link to this post

    If I change my implementation to use Window instead of RadWindow, then the problem disappears.

    For now I'm using the code below in the "Closed" event handler, which fixes it for now.  I'd be interested to know if the bug can be tracked down though...

    var window = Owner as Window;
    if (window != null)
  6. Licensing
    Licensing avatar
    31 posts
    Member since:
    Sep 2011

    Posted 21 Nov 2013 Link to this post


    Is solution for this issue found? Or is it still being investigated?
  7. Yana
    Yana avatar
    4654 posts

    Posted 26 Nov 2013 Link to this post


    This issue is logged in our internal backlog, but I am afraid that it is not fixed yet.  At the moment we cannot commit to any timeframe for fixing it.

    I am sorry for the caused inconvenience.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 03 Mar 2014 Link to this post

    I think I'm facing the same issue.  When I close a showDialog radwindow and the try to focus on a textbox (on a content control on the mainpage ) it doesn't work.  If it's just a dialog() it works though.

    If I use a regular window instead of a radwindow it's fine.

    Is there a tracker on this?  Many of my users are keyboard data entry users who tab through everything.
  9. Yana
    Yana avatar
    4654 posts

    Posted 07 Mar 2014 Link to this post

    Hi Dan,

    This looks like a different behavior than the previously discussed - in the described in this thread scenario the main Window is minimized when the dialog is closed . I would ask you to send us more details on your exact case, so we to be able to research it further.


    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

  10. Daniel B.
    Daniel B. avatar
    18 posts
    Member since:
    Apr 2015

    Posted 06 Jul 2015 Link to this post

    @Yana, im seeing the issue described in the original thread (minimization of main window on show() OR showDialog() close via close button

     Im using UI for WPF, v2015.1.401.45 (Dev)

  11. Nasko
    Nasko avatar
    704 posts

    Posted 09 Jul 2015 Link to this post


    The problem is caused by setting the Owner to MainWindow. The same behavior could be observed in the native WPF Window as well. What we could suggest you is to check the workarounds proposed by Zoltan and Charles in order to resolve the issue or to remove the Owner of the visualized RadWindow. Please, check the attached sample project that demonstrates how the Window behaves when there is set Owner and when there isn't.

    Hopes this helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  12. karim
    karim avatar
    1 posts
    Member since:
    Aug 2016

    Posted 03 Aug 2016 Link to this post


    Try after secondWindow.close()


    and add after secondWindow.ShowDialog(firstWindow)


Back to Top