windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-columnheadercustomdraweventargs.md
Gets the GridColumn whose header is to be drawn. Returns null if an “empty column header” is currently being painted.
Namespace : DevExpress.XtraGrid.Views.Grid
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public GridColumn Column { get; }
Public ReadOnly Property Column As GridColumn
| Type | Description |
|---|---|
| GridColumn |
A GridColumn whose header is to be drawn.
|
When the column auto-width feature is disabled (see GridOptionsView.ColumnAutoWidth), the grid View displays an “empty column header” after data columns. In banded grid Views, an “empty band header” and “empty column header” are displayed in this case.
The GridView.CustomDrawColumnHeader event fires repeatedly for each column header, including the “empty column header”. When this event is fired for the “empty column header”, the event’s Column parameter returns null.
Similarly, the BandedGridView.CustomDrawBandHeader event fires in a banded grid View repeatedly for each band header, including the “empty band header”. When this event is fired for the “empty band header”, the event’s Band parameter returns null.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Column 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.
winforms-grid-add-check-box-to-column-header/CS/GridViewColumnHeaderExtender.cs#L156
{
if (e.Column == null) return;
DefaultDrawColumnHeader(e);
winforms-grid-hot-track-focused-column-header/CS/WindowsApplication1/Form1.cs#L33
GridView view = sender as GridView;
if (e.Column?.FieldName == view.FocusedColumn.FieldName)
e.Info.State = ObjectState.Hot;
winforms-grid-multiple-row-selection-web-style-checkboxes/CS/E1271/CheckMarkSelection.cs#L230
void View_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e) {
if(e.Column == column) {
e.Info.InnerElements.Clear();
{
if (e.Column == _Column)
{
winforms-grid-custom-button-in-column-header/CS/WindowsApplication3/ColumnHeaderExtender.cs#L112
void OnCustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e) {
if(e.Column == null) return;
DefaultDrawColumnHeader(e);
winforms-grid-add-check-box-to-column-header/VB/GridViewColumnHeaderExtender.vb#L147
Private Sub OnCustomDrawColumnHeader(ByVal sender As Object, ByVal e As ColumnHeaderCustomDrawEventArgs)
If e.Column Is Nothing Then
Return
winforms-grid-hot-track-focused-column-header/VB/WindowsApplication1/Form1.vb#L35
Dim view As GridView = TryCast(sender, GridView)
If Equals(e.Column?.FieldName, view.FocusedColumn.FieldName) Then e.Info.State = ObjectState.Hot
End Sub
winforms-grid-multiple-row-selection-web-style-checkboxes/VB/E1271/CheckMarkSelection.vb#L270
Private Sub View_CustomDrawColumnHeader(ByVal sender As Object, ByVal e As ColumnHeaderCustomDrawEventArgs)
If e.Column Is column Then
e.Info.InnerElements.Clear()
Private Sub view_CustomDrawColumnHeader(ByVal sender As Object, ByVal e As ColumnHeaderCustomDrawEventArgs)
If e.Column Is _Column Then
e.Info.Caption = String.Empty
winforms-grid-custom-button-in-column-header/VB/WindowsApplication3/ColumnHeaderExtender.vb#L118
Private Sub OnCustomDrawColumnHeader(ByVal sender As Object, ByVal e As ColumnHeaderCustomDrawEventArgs)
If e.Column Is Nothing Then
Return
See Also
ColumnHeaderCustomDrawEventArgs Class