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

How to close RadWindow(s) programmaticaly?

1 Answer 394 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dean
Top achievements
Rank 1
Dean asked on 13 Nov 2014, 10:27 PM
I need to close RadWindow(s) which are children of Application.Current.MainWindow programmatically but RadWindows present as "Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper+WindowHostWindow: Window Header" so I'm unable to cast that back to RadWindow and use Close() method. Here is what I tried:

                foreach (var w in Application.Current.Windows)
                {
                    var rw = w as RadWindow;
                    if (rw == null) continue;
                    rw.Close();
                }

                foreach (var rw in Application.Current.MainWindow.ChildrenOfType<RadWindow>())
                {                    
                    rw.Close();
                }

So, how exactly do I close RadWindow(s) which are children of Application.Current.MainWindow programmatically?

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 17 Nov 2014, 08:40 AM
Hello Dean,

Thank you for contacting us.

The easiest way of closing all of the RadWindow instances in the current application is to use the RadWindowManager class and call its CloseAllWindows() method. More information could be found in our online help here. The next code snippet shows the described approach:
private void CloseAllRadWindows(object sender, RoutedEventArgs e)
{
    Telerik.Windows.Controls.RadWindowManager.Current.CloseAllWindows();
}

Hope this is helpful.

Regards,
Vladi
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Dean
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or