Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight: Modal ChildWindow keeps parent grayed after closing

When my modal ChildWindow closes, the parent control does not get "un-grayed" and all user input is blocked, forcing me to restart the application. Exact scenario which causes this behavior consistently:

  1. ChildWindow A pops up and user clicks a custom button on the bottom of the window (instead of OK or Cancel). My code does some work and then calls the Close() method for the ChildWindow.
  2. ChildWindow A closes and functionality is restored to parent control (controls are un-grayed).
  3. User causes ChildWindow B to pop up. User clicks system-generated OK or Cancel button.
  4. ChildWindow B closes, but the parent controls are still grayed out and inaccessible.

Either of the windows work fine repeatedly on their own. Any thoughts?

like image 622
user812558 Avatar asked Jun 23 '11 15:06

user812558


1 Answers

I saw something similar (it might not fix your exact problem) and found some discussion about the ChildWindow here

they suggested this method in the ChildWindow Closed event and it worked for me.

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

Also try calling this.DialogResult = true instead of the Close method.

like image 51
AlignedDev Avatar answered Oct 19 '22 08:10

AlignedDev