List View Bands Layout
- 3 minutes to read
Band is a logical group of columns. In the WinForms Data Grid and ASP.NET Web Forms Grid View controls, a band is visualized as a header displayed above headers of the columns it combines. This topic describes the use of the Banded Grid Views feature in a WinForms XAF application and the Bands feature in an ASP.NET Web Forms XAF application.
Note
You can see the demonstration of bands in the List Editors | Grid | Banded List View section of the Feature Center demo. The default location of the application is %PUBLIC%\Documents\DevExpress Demos 24.1\Components\XAF\FeatureCenter.NETFramework.XPO.
Bands Layout
Bands layout is defined in the Application Model by the structure of the IModelBandsLayout node.
You can add IModelBand child nodes using the Add… | Band context menu command to define bands, and then drag-and-drop columns into the created bands. You can add a band inside an existing band to create a complex bands hierarchy.
Note
Step-by-step instructions on how to configure the bands layout displayed above is available in the How to: Configure Bands in a Grid List Editor (WinForms and ASP.NET Web Forms) topic.
Bands layout settings have effect on the List View only when the IModelBandsLayout.Enable property is set to true. By default, this property is set to false and you cannot add bands.
The IModelListView.EditorType property of the banded List View should be GridListEditor or ASPxGridListEditor (the actual List Editor type is available in the platform-specific project’s model). Other built-in List Editors do not support bands.
Row Index
In a WinForms application, the Banded Grid Views is used to display bands. It allows you to arrange column headers across rows. You can also stretch column headers vertically so that they occupy more than one row. The column header vertical position is identified by the IModelBandedColumnWin.RowIndex property of the Views | <ListView> | BandsLayout | Band | Column node.
This property specifies the zero-based row number of the current column within a band. In the image below, the Subject column’s RowIndex is 1. The RowIndex of the Status and Assigned To columns is 0.
Headers Visibility
You can hide band and column headers using the IModelBandsLayoutWin.ShowBands and IModelBandsLayoutWin.ShowColumnHeaders properties of the Views | <ListView> | BandsLayout node.
These properties are available in WinForms projects only.
End-User Customizations
A user can rearrange bands, reorder columns within a band, move columns and bands from one parent band to another. The modified layout is saved to the user differences of the Application Model. In WinForms applications, you can restrict these customizations using the following properties of the Views | <ListView> | BandsLayout node.
- IModelBandsLayoutWin.AllowBandMoving
- IModelBandsLayoutWin.AllowChangeBandParent
- IModelBandsLayoutWin.AllowChangeColumnParent
- IModelBandsLayoutWin.AllowColumnMoving
These properties are available in WinForms projects only.
You can use the Reset View Settings Action to undo all runtime customizations in the current View.
Important
When configuring bands, keep in mind the differences in behavior between WinForms and ASP.NET Web Forms grid controls:
- Columns that are not added to any band are visible in ASP.NET Web Forms applications only. The WinForms grid control does not display such columns.
- The IModelBandedColumnWin.RowIndex option is available for WinForms only. You cannot arrange column headers across rows in ASP.NET Web Forms applications.
- Options that restrict band configuration by users (see IModelBandsLayoutWin) are available in WinForms only.
That is why we recommend the following:
- Setup bands separately for WinForms and ASP.NET Web Forms. Configuring bands in a platform-agnostic module is suitable for very simple band layouts only.
- Avoid merging platform-specific band configuration in a common module.