Back to Devexpress

DockPanel.Visibility Property

windowsforms-devexpress-dot-xtrabars-dot-docking-dot-dockpanel-ae6041a3.md

latest9.8 KB
Original Source

DockPanel.Visibility Property

Gets or sets the panel’s visible state.

Namespace : DevExpress.XtraBars.Docking

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(DockVisibility.Visible)]
[XtraSerializableProperty]
public DockVisibility Visibility { get; set; }
vb
<DefaultValue(DockVisibility.Visible)>
<XtraSerializableProperty>
Public Property Visibility As DockVisibility

Property Value

TypeDefaultDescription
DockVisibilityVisible

A DockVisibility value representing the panel’s visible state.

|

Available values:

NameDescription
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.

winforms-spreadsheet-use-cell-range-as-data-source/CS/RangeDataSourceForSnap/Form1.cs#L86

csharp
sheetPageCategory.Visible = true;
reportExplorerDockPanel1.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
fieldListDockPanel1.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;

winforms-richedit-document-api/CS/RichEditAPISample/DisplayResultControl.cs#L27

csharp
{
    get { return (dockPanel1.Visibility != DockVisibility.Visible) ? true : false;}
    set { dockPanel1.Visibility = (value) ? DockVisibility.Visible : DockVisibility.Hidden; }

winforms-docking-display-custom-header-buttons/CS/CustomHeaderButtonsExample/Form1.cs#L25

csharp
void panelContainer1_CustomButtonUnchecked(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e) {
    panelContainer1.Visibility = DockVisibility.Visible;
}

winforms-spreadsheet-use-cell-range-as-data-source/VB/RangeDataSourceForSnap/Form1.vb#L89

vb
sheetPageCategory.Visible = True
reportExplorerDockPanel1.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden
fieldListDockPanel1.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden

winforms-richedit-document-api/VB/RichEditAPISample/DisplayResultControl.vb#L26

vb
Get
    Return If(dockPanel1.Visibility <> DockVisibility.Visible, True, False)
End Get

winforms-docking-display-custom-header-buttons/VB/Form1.vb#L27

vb
Private Sub panelContainer1_CustomButtonUnchecked(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Docking2010.ButtonEventArgs)
    panelContainer1.Visibility = DockVisibility.Visible
End Sub

See Also

Hide()

Show()

ActivePanel

AutoHideContainers

HiddenPanels

Panels

RootPanels

VisibilityChanged

HidePanelsImmediately

DockPanel Class

DockPanel Members

DevExpress.XtraBars.Docking Namespace