Skip to main content

DockLayoutManager.DockItemClosed Event

Fires after a dock item has been closed (hidden).

Namespace: DevExpress.Xpf.Docking

Assembly: DevExpress.Xpf.Docking.v23.2.dll

NuGet Package: DevExpress.Wpf.Docking

Declaration

public event DockItemClosedEventHandler DockItemClosed

Event Data

The DockItemClosed event's data class is DevExpress.Xpf.Docking.Base.DockItemClosedEventArgs.

Remarks

To prevent a dock item from being closed, disable the BaseLayoutItem.AllowClose option or handle the DockLayoutManager.DockItemClosing event.

Closed items can be accessed via the DockLayoutManager.ClosedPanels collection. To close an item in code, use the DockControllerBase.Close method provided by the DockLayoutManager.DockController object.

The currently closed dock item is specified by the event’s Item parameter.

Floating panels are created with the help of FloatGroup. If a float group contains a single panel, a single close (‘x’) button exists there:

FloatPanel1

Clicking this button closes the float group, hiding the nested dock panel. The DockItemClosed event fires only for the float group object. To access the dock panel nested within the float group, see the float group’s LayoutGroup.Items collection.

If a float group contains two or more panels, the ‘x’ button is displayed for the float group, and all its nested panels:

FloatGroup_2panels_mod

Again, clicking the ‘x’ button for the float group fires the DockItemClosed event for the float group object. If the ‘x’ button is clicked for panels, the DockItemClosed event fires, with the Item parameter referring to the corresponding panel.

If a container (eg. a float group) that contains one or multiple items is about to be closed, all its items will be closed as well. To access the child items that are about to be closed, use the following code:

void manager_DockItemClosed(object sender, ItemEventArgs e) {
    DockItemClosedEventArgs ea = e as DockItemClosedEventArgs;
    foreach(BaseLayoutItem item in ea.AffectedItems) { 
        //...
    }
}
See Also