A problem with ChildWindow in Silverlight 5

A problem with ChildWindow in Silverlight 5

Probably many of you know about the problem with ChildWindows in Silverlight 5 -- “When the last child window is closed, the RootVisual is not enabled, resulting in a "hanging" a Silverlight application.” [http://connect.microsoft.com/VisualStudio/feedback/details/715768/closing-silverlight-childwindow-does-not-reenable-rootvisual].

This can cause the following problem: an interface of a Silverlight Report Viewer can become disabled after closing one of the child windows. Since it’s not clear if there will be a new version of Silverlight or a fix for current Silverlight 5 we can offer you a workaround to solve it.

When creating a new instance of ChildWindow you need to add the handler for closing the window in which we forcibly set the following: Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, true);

Below is a sample code that demonstrates how it works:

private void OpenWindow(object sender, System.Windows.RoutedEventArgs e)


 var window = new ChildWindow();

 window.Closed += window_Closed;

 window.Title = "Sample";

 window.Width = 500;

 window.Height = 500;





 void window_Closed(object sender, EventArgs e)


 Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, true);


Add Feedback