Close RadWindow from a User control

2 posts, 0 answers
  1. Don
    Don avatar
    22 posts
    Member since:
    Oct 2007

    Posted 11 Nov 2009 Link to this post

    One of my Menu option on the MainPage.XAML is to bring up a dialog Window. The dialog window contains a User control.  Based on some  condition we need to close the dialog from the user control. How do we get hold of the running Window in the user controls and then close it.
     
    Thanks Don   
  2. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 12 Nov 2009 Link to this post

    If you want to close it from a button you would do something like this in the buttons Click event handler:

    var win = (sender as UIElement).ParentOfType<RadWindow>(); 
                if(win != null
                    win.Close(); 
     
    To get access to the extension method you also have to do this:
    using Telerik.Windows; 

  3. DevCraft banner
Back to Top