Handle click outside window in ShowDialog

2 posts, 1 answers
  1. Jared Robertson
    Jared Robertson avatar
    1 posts
    Member since:
    May 2010

    Posted 11 Jun 2012 Link to this post

    The silverlight forums have this exact same question and a great solution for it: http://www.telerik.com/community/forums/silverlight/window/handle-click-outside-window-in-showdialog.aspx#0
    However, the solution doesn't work in WPF.

    Basically I need to be able to close the RadWindow if the user clicks outside of it. For the silverlight version, the canvas that covers the application is exposed and I can attach a MouseLeftButtonDown event handler to it. I haven't been able to do this for the WPF version because none of the accessible parents are the background where a user would click. The parents of the RadWindow are ContentPresenter, AdornerPresenter, Border, and then InternalWindow (I can't access InternalWindow).

    Thanks in advance!
  2. Answer
    Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 12 Jun 2012 Link to this post

    Hi Jared,

    I don't think that this can be achieved in a similar way into WPF. The best I can think of is to handle your MainWindow's Activated event and close the opened dialogs there. Into this case you will have to use Show instead of ShowDialog.

    All the best,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top