Skip to main content

DockPanel.Visibility Property

Gets or sets the panel’s visible state.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(DockVisibility.Visible)]
[XtraSerializableProperty]
public DockVisibility Visibility { get; set; }

Property Value

Type Default Description
DockVisibility Visible

A DockVisibility value representing the panel’s visible state.

Available values:

Name Description
Visible

The panel is visible.

Hidden

The panel is hidden.

AutoHide

The panel is auto-hidden.

Remarks

This property can be used to set a panel’s visible state. The available values are DockVisibility.Visible, DockVisibility.Hidden and DockVisibility.AutoHide.

A panel whose Visibility property is set to DockVisibility.Hidden is not displayed on screen. So its contents are not available to end-users. Hidden panels can be accessed via the DockManager.HiddenPanels collection. An end-user can hide a panel by clicking on the panel’s Close (‘x’) button. This behavior however can be prevented by hiding the Close button (via the BaseDockOptions.ShowCloseButton option) or by canceling the default closing mechanism (via the DockManager.ClosingPanel event).

Set the Visibility property to DockVisibility.AutoHide to activate the auto-hide functionality for the panel. Such a panel is automatically hidden to an auto-hide container (bar) when the mouse cursor leaves the panel’s region. Auto-hidden panels can be accessed via the DockManager.AutoHideContainers collection.

Panels which are not hidden nor auto-hidden are visible and their Visibility property is set to DockVisibility.Visible. To get the visible floating panels and the panels docked to the form, use the DockManager.RootPanels collection. This collection however does not include the visible panels which are docked to other panels. Access to the panels which are owned by other panels is provided by the DockPanel.Item indexer.

Changing the Visibility property moves a panel to the corresponding collection. When the panel’s visible state is changed the DockManager.VisibilityChanged event is triggered.

The DockPanel.Show method can be used to display a panel onscreen and then activate it. To get the currently active panel, use the DockManager.ActivePanel property.

The DockPanel.Hide method hides a panel.

Notes:

  1. For floating panels (visible and hidden) the auto-hide functionality cannot be enabled. The panel should be docked to the form or to the panel residing within the form first.
  2. The Visibility property cannot be set to DockVisibility.Visible for individual panels that belong to auto-hidden tab containers. This property can only be changed for tab containers in this case.
  3. Do not change the panel’s Visibility property or call the DockPanel.MakeFloat method in the form’s constructor. Use the DockManager.Load event for this purpose.

Important note: a panel’s Visibility property may not reflect the actual visibility state. For instance, if a panel is within a hidden float tab container, the panel’s Visibility property returns DockVisibility.Visible but the panel is invisible to end-users. In such cases, a panel’s visibility is specified by its root panel, so you should use the root panel’s Visibility property. Root panel can be obtained via the DockPanel.RootPanel property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Visibility property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also