Skip to main content
A newer version of this page is available. .

DataControlBase.Columns Property

Gets a collection of the GridControl’s columns.

Namespace: DevExpress.WinUI.Grid

Assembly: DevExpress.WinUI.Grid.v22.1.dll

NuGet Package: DevExpress.WinUI

Declaration

public GridColumnCollection Columns { get; }

Property Value

Type Description
GridColumnCollection

A collection of the GridControl‘s columns.

Remarks

The GridControl stores its columns in the Columns collection. This collection’s methods allow you to add new and remove existing columns. ColumnBase descendants are individual columns. You can access columns by a field name (ColumnBase.FieldName) or an index.

<dxg:GridControl ItemsSource="{x:Bind ViewModel.Source}" AutoGenerateColumns="False">
    <dxg:GridControl.Columns>
        <dxg:GridTextColumn FieldName="ProductName"/>
        <dxg:GridSpinEditColumn FieldName="UnitPrice"/>
        <dxg:GridTextColumn FieldName="Quantity"/>
    </dxg:GridControl.Columns>
</dxg:GridControl>

WinUI Data Grid Columns

Use the DataControlBase.VisibleColumns property to access only visible columns (the ColumnBase.Visible property value is true).

See Also