GridColumn.Visible Property
Gets or sets whether the grid column is visible.
Namespace: DevExpress.XtraGrid.Columns
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
#Declaration
[DefaultValue(false)]
[DXCategory("Appearance")]
[XtraSerializableProperty]
[XtraSerializablePropertyId(3)]
public virtual bool Visible { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Boolean | false | true if the column is visible; otherwise, false. |
#Remarks
The Visible and GridColumn.VisibleIndex properties specify the column’s visible state and position. When you hide/show the column with the Visible property, the GridColumn.VisibleIndex property automatically reflects the changes. Similarly, if you toggle the column’s visibility with the GridColumn.VisibleIndex property, the Visible property changes automatically. See GridColumn.VisibleIndex to learn more.
The code sample below illustrates how to change grid column visibility based on the user’s permissions.
public class UserPermissions
{
public bool canSeeProductId;
public bool canSeeProductActions;
}
UserPermissions permissions = new UserPermissions();
permissions.canSeeProductId = false;
permissions.canSeeProductActions = false;
gridView1.Columns["productId"].Visible = permissions.canSeeProductId;
gridView1.Columns["productActions"].Visible = permissions.canSeeProductActions;
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Visible 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.