BaseLayoutItem.Visibility Property
Allows you to hide the item from the Layout Control and Customization Form.
Namespace: DevExpress.XtraLayout
Assembly: DevExpress.XtraLayout.v24.2.dll
Declaration
[DefaultValue(LayoutVisibility.Always)]
[DXCategory("Behavior")]
[XtraSerializableProperty]
public LayoutVisibility Visibility { get; set; }
Property Value
Type | Default | Description |
---|---|---|
LayoutVisibility | Always | A LayoutVisibility value that specifies whether the item is visible in the layout and the Customization Form. |
Available values:
Name | Description |
---|---|
Always | A layout item is not collapsed. It is displayed in its original size in regular and customization modes. |
Never | A layout item is collapsed. |
OnlyInCustomization | A layout item is visible in customization mode, and collapsed in regular mode (when customization is not performed). |
OnlyInRuntime | A layout item is visible in regular mode, and collapsed in customization mode. |
Remarks
Note
The Layout Control manages the visibility of controls embedded in layout items. Do not use an embedded control’s Visible property to specify its visibility. If you wish to hide a layout item or its control, use the item’s properties and methods instead.
Hide items to the Customization Form
You can use the context menu and drag-and-drop operations to hide items to - or restore items from - the Customization Form. To change item visibility at runtime, you first need to activate customization mode.
To hide items to (or restore items from) the Customization Form in code, use the BaseLayoutItem.HideToCustomization and BaseLayoutItem.RestoreFromCustomization methods.
When layout items are hidden to the Customization Form, they do not retain their positions in the layout.
Use the LayoutControl.HiddenItems collection to access items hidden to the Customization Form.
Collapse items (Hide items without showing them in the Customization Form)
The Visibility property allows you to hide items and prevent access to them from the Customization Form’s Hidden Items tab. These items are not accessible from the LayoutControl.HiddenItems collection either.
A layout item hidden with the Visibility property retains its position within the LayoutControl. This item is collapsed to a one pixel-width transparent line. Two or more adjacent hidden items are collapsed to a two pixel-width transparent line. When a hidden item’s visibility is restored, it is displayed at its previous position.
Hide an item’s contents
The LayoutControlItem.ContentVisible property specifies the visibility of the item’s contents (embedded control, text label, and image). When you hide the item’s contents, the item retains its size and position. It is displayed as an empty rectangle.
The following animation shows the difference between the ContentVisible and Visibility properties.