Tutorial: Banded Grid View - User Customization
- 3 minutes to read
This walkthrough is a transcript of the Banded Grid View - User Customization video available on the DevExpress YouTube Channel.
In this tutorial, you will learn about band customization features available to end-users at runtime, including band resizing, band and column re-ordering, hiding and displaying bands. The tutorial will also show you how to override the functionality available to end-users by default.
At runtime, end-users can resize any grid band by dragging the band's right edge.
They can drag-and-drop band headers to reorder bands along with their child columns.
Note though that columns and bands can only be moved within their parent bands. Thus, bands allow end-users to re-arrange columns while preserving their logical grouping.
The grid supports the Microsoft Outlook style Customization Form, which can be invoked using the band or column header context menu.
Drag-and-drop a band's header to the Customization Form to hide the band along with its child columns.
To display a band, drag it back to the band panel.
End-users can also quickly hide bands by dragging their headers away from the header panel.
Now see how to control which of these features are available to end users.
Disabling Band Resizing
Run the application to see that the Model band's right edge cannot be dragged. However, end-users can still resize other bands, which can still affect the Model band's width.
Close the application and disable band resizing for the entire View. To do this, expand the View's BandedGridView.OptionsCustomization property and disable the BandedGridOptionsCustomization.AllowBandResizing option.
Run the application again. No bands allow resizing operations.
Allowing Changing Parent Bands
To enable column and band drag-and-drop between parent bands, go to the Property grid displaying the View's settings, expand BandedGridView.OptionsCustomization and enable the BandedGridOptionsCustomization.AllowChangeBandParent and BandedGridOptionsCustomization.AllowChangeColumnParent options.
As a result, end-users can change column and band positions without any restrictions.
Disabling Band Re-Ordering
The grid also allows you to prohibit re-ordering of individual or all bands. Open the Property grid displaying the Model band's settings, expand the GridBand.OptionsBand property and disable the OptionsBand.AllowMove option.
Now you cannot change this band's position by dragging its header. It can still change its position as a result of re-ordering other bands.
To disable band re-ordering for the entire view, set the View's BandedGridOptionsCustomization.AllowBandMoving property to false. As a result, end-users cannot move or hide bands.
Reset these settings to enable band drag and drop again.
Restricting Hiding and Displaying Bands
After that, disable the View's GridOptionsCustomization.AllowQuickHideColumns option. As a result, bands with their nested columns cannot be hidden by dragging them away from the header panel. However, end-users can still use the Customization Form.
Once headers are displayed in the Bands tab, they can be dragged back to the View. The grid allows you to override this. Set the Model band's OptionsBand.ShowInCustomizationForm property to false. Now when you hide this band, it disappears and its header is not displayed in the Customization Form.
If you disable the View's BandedGridOptionsCustomization.ShowBandsInCustomizationForm option, the Bands tab is not displayed at all.