I have a main form; this has a docking manager that has several windows that can be docked and/or floated. I want to disable the main form and all of the docking manager''s forms.
When I set the Enabled property on the main form, the UI interaction with its children should be disabled as well.
The docked windows get disabled, but I am still able to interact with the floating windows.
One way to fix this (and probably not the best) is to enumerate through the docking manager''s controls and individually set Enabled to false for each one.
Is there a better way to do this?
Thanks for bringing this to our attention. I have tested for this issue here, and have observed that the floating windows are still active eventhough the HostForm is disabled. I have notified the development team in this regard, and we have logged a QA report #389 on this.
Like you mentioned above, the only workaround that you could use is to iterate through the list of DockingManager''s Controls and disable all the floating windows. But please note that you cannot directly set the Control.Enabled property to false here. This is because the floating window is a slightly more complex structure than a docking window, consisting of 2 Containers within which the Control is embedded. In a floating window, the Control is hosted within a DockHost Container, and the the DockHost in turn is hosted within a FloatingForm (outer most Container). You should set the FloatingForm.Enabled to false to disable the floating window. Please refer to the code snippet below for this purpose :
IEnumerator ienum = this.dockingManager1.Controls;
ArrayList dockedctrls = new ArrayList();
foreach(Control ctrl in dockedctrls)
DockHost dhost = ctrl.Parent as DockHost;
FloatingForm fform = dhost.ParentForm as FloatingForm;
fform.Enabled = false;
I have also attached the complete sample illustrating this here. Please let me know if you have any other questions.