DataControlBase.Columns Property
In This Article
Gets a collection of the GridControl’s columns.
Namespace: DevExpress.WinUI.Grid
Assembly: DevExpress.WinUI.Grid.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
public GridColumnCollection Columns { get; }
#Property Value
Type | Description |
---|---|
Grid |
A collection of the Grid |
#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>
Use the DataControlBase.VisibleColumns property to access only visible columns (the ColumnBase.Visible property value is true).
See Also