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
255
Removing DockControl Pane when pressing the close button
posted

Hi All,

I ran across the same issue as described in the following link, http://community.infragistics.com/forums/t/1113.aspx

I tried the solution proposed and it worked to a large extent. When I click on the X button I get a panehidden message, where I close my control and dispose the dockcontrolpane. When I save and load the layout, I get a empty panel in  the top left corner. After playing around with it quite a bit I couldn't get around removing the blank panel. 

Is there a solution for this? Can you point me in the right direction ? 

See my creation code and remove code below,

.// My usercontrol

LiveVariableDataControl wpf = new LiveVariableDataControl();

wpf.Size = new Size(200, 200);

 

UltraTile tile = new UltraTile();

tile.Control = wpf;

 

UltraTilePanel tilep = new UltraTilePanel();

tilep.TileSettings.ShowCloseButton = Infragistics.Win.DefaultableBoolean.True;

tilep.Appearance.BackColor = Color.Transparent;

tilep.add(tile);

 

DockableControlPane dockableControlPane1 = new DockableControlPane(tilep);

dockableControlPane1.Size = new Size(210, 210);

dockableControlPane1.Settings.Appearance.BackColor = Color.Transparent;

DockableControlPane dockableControlPane1 = new DockableControlPane(tilep);

dockableControlPane1.Size = new Size(210, 210);

dockableControlPane1.Settings.Appearance.BackColor = Color.Transparent;

 

DockAreaPane flpane =   MainFormDockManager.DockAreas.Add(DockedLocation.DockedLeft);

flpane.Panes.Add(dockableControlPane1);

flpane.Closed = false;

flpane.Tag = id;

flpane.Size = new System.Drawing.Size(264, 583);

flpane.Settings.Appearance.BackColor = Color.Transparent; 

 

//Pane Hidden method

private void MainFormDockManager_PaneHidden(object sender, PaneHiddenEventArgs e)

{

 removeControlPaneAndChildren(e.Pane);

 e.Pane.Closed = true;

}

 

private void removeControlPaneAndChildren(DockableControlPane pane)

{

            UltraTilePanel tilep = pane.Control as UltraTilePanel;

            if (tilep != null)

            {

                while (tilep.Tiles.Count > 0)

                {

                    UltraTile tile = tilep.Tiles[0];

                    IUIControl ctrl = (IUIControl)tile.Control;

                    ctrl.close();

                    tile.Control.Dispose();

 

                    tilep.Tiles.Remove(tile);

                    tile.Dispose();

                }

 

            }

            pane.Dispose();

}

Any help is greatly appreciated

 

Thanks!

Parents
  • 53790
    posted

    Hello Ssinha,

    I`m not sure that I understand well your scenario, but when I try the code below I`m able to remove the hiden Panes from my ControlPanesCollection.

    private bool IsRemoved;

    private void ultraDockManager1_PaneHidden(object sender, PaneHiddenEventArgs e)

    {

        if (!IsRemoved)

        {

            IsRemoved = true;

            ultraDockManager1.ControlPanes.Remove(e.Pane.Control);

            IsRemoved = false;

        }

              

    }

    Please take a look at the attached video with debuging of my test sample. Please take a look at the total numbers of the Panes at the beggining and at the end of the test. Let me know if you think that I misunderstand your scenario or if you have any questions.

Reply Children