Hi, I have a situation where I have setup an ultraDockManager with docked controls. I am calling ultraDockManager.LoadFromBinary(stream) to reload the dock layout. This is causing an invocation of UltraDockManager.ReparentControl() for most if not all the controls. Is this to be expected?
Thanks, Bill
Hello Bill,
When loading the UltraDockManager via a LoadFromBinary()/LoadFromXML() call, the entire layout of component is recreated. As such, the UltraDockManager is essentially resets back to its default state. In doing so, all controls currently docked using the UltraDockManager are reparented back to their original container (or the hosting control). After the UltraDockManager creates all of the new panes for the new layout, it associates all the controls referenced by the new panes and reparents the control to the pane's window.
We use the UltraDockManager.ReparentControl() method to perform the reparenting of one control to another which occurs when moving the control back to it's original container, and again when moving the control from the original container to the new pane.
Hopefully this explains why the ReparentControl() method is invokes so many times. Let me know if you have any further questions.
Thanks,
Chris
Hi Chris,
Thanks for the prompt reply. That explains it. The reason for asking is because we have OnVisibleChanged event handlers in our code and they are being called a number of times for each control. From your explanation I would presume that the processing that ReparentControl() performs is causing each control's Visible attribute to be changed a number of times, thus causing these handlers to be called multiple times.
Bill
I see. Easiest solution if there is code in the VisibleChanged event handlers you don't want processed is to add a flag to your form that you set to true prior to calling LoadFromBinary(), and revert back to its original value after the load completes. You can then, check for the flag in the event handlers.
Let me know if you need further assistance.
I will use your suggested solution. Thanks for the help!