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

Close RadWindow from a User control

1 Answer 92 Views
Window
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 11 Nov 2009, 07:45 PM
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   

1 Answer, 1 is accepted

Sort by
0
hwsoderlund
Top achievements
Rank 1
answered on 12 Nov 2009, 09:59 AM
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; 

Tags
Window
Asked by
Don
Top achievements
Rank 1
Answers by
hwsoderlund
Top achievements
Rank 1
Share this question
or