BaseLayoutItem.AllowHide Property

Gets or sets whether the item can be hidden (auto-hidden, for dock items). This is a dependency property.

Namespace: DevExpress.Xpf.Docking

Assembly: DevExpress.Xpf.Docking.v21.1.dll

Declaration

public bool AllowHide { get; set; }

Property Value

Type Description
Boolean

true, if the item can be hidden (auto-hidden, for dock items); otherwise, false.

Remarks

Hide Dock Items

In Xaml

Create an AutoHideGroup, add a panel to the group, and then add the group to the DockLayoutManager.AutoHideGroups collection.

<Window ...
  xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking">
  <dxdo:DockLayoutManager>
    <dxdo:DockLayoutManager.AutoHideGroups>
      <dxdo:AutoHideGroup DockType="Right" AllowHide="True">
        <dxdo:LayoutPanel Caption="Panel1"/>
      </dxdo:AutoHideGroup>
    </dxdo:DockLayoutManager.AutoHideGroups>
  </dxdo:DockLayoutManager>
</Window>

In Code Behind

Use the DockController‘s IDockController.Hide methods to auto-hide a specific dock item.

DockLayoutManager1.DockController.Hide(Panel1, Dock.Right);

DockLayoutManager - AutoHideGroups - InCode

Hide Layout Items

Use the DockLayoutManager.LayoutController object’s LayoutController.Hide method to hide Layout items.

Panel’s Data Context

When you set the LayoutPanel‘s AutoHide property to true, the LayoutPanel DataContext can be changed, because the panel is placed inside a new AutoHideGroup.

Subscribe to the LayoutPanel’s DataContextChanging event to catch the moment when the panel’s DataContext is changed.

When this occurs, you can specify your own DataContext for the panel. Subscribe to the DockManager.DockOperationCompleted event to catch the moment when your panel is hidden, and specify your own DataContext.

The following code sample changes ContentPanel LayoutPanel‘s DataContext when the panel is hidden:

private void dockManager_DockOperationCompleted(object sender, DevExpress.Xpf.Docking.Base.DockOperationCompletedEventArgs e) {
    if(e.Item.Name == "ContentPanel" && e.DockOperation == DockOperation.Hide ) {
        e.Item.DataContext = YourDataContext;
    }
}
See Also