Silverlight: Modal ChildWindow keeps parent grayed after closing

旧街凉风 提交于 2019-12-23 10:53:22

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/6456952/silverlight-modal-childwindow-keeps-parent-grayed-after-closing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!