Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
380
Panes do not seem to be closing correctly
posted

We are trying to allow users to close all panes and then automatically reset the panes to how they originally are out of the box. However, it seems that one pane will not close.

foreach (Infragistics.Win.UltraWinDock.DockableControlPane pane in this.ultraDockManager.ControlPanes)
{
    pane.Close(true);
    this.ultraDockManager.ControlPanes.Remove(pane);
}

This code doesn't appear to work correctly. After it has run through all the panes that are visible and exits the loop, there is still one more pane left. When the default panes are opened, the same pane type that is not removed is stuck in the top left corner, unable to be moved or resized. Any suggestions?

  • 71886
    Verified Answer
    Offline posted

    Hello icssupport,

    Changing collection contents with the foreach statement can cause unpredictable side effects.

    You could try an approach like the following:

                for (int i = ultraDockManager1.ControlPanes.Count-1; i >= 0; i--)

                {

                    this.ultraDockManager1.ControlPanes[i].Close(true);

                    this.ultraDockManager1.ControlPanes.Remove(this.ultraDockManager1.ControlPanes[i]);

                }

    Please note, we are making efforts to ensure all posts are addressed by an Infragistics expert. We believe that the other community members could benefit from this thread as well.

    Feel free to write me if you need further assistance.