Search code examples
c#devexpressgridcontrol

Removing extra spaces from column header


I'm using DevExpress GridControl in my C# WPF application. I've property names like ProductType, ProductCategory etc .in my collection that is being used as ItemSource to this grid.(AutoGeneratingColumn is set to true.) But I see that the grid adds extra space between words in the column header caption...for e.g. Product Type, Product Category etc.

Is there any way I can remove spaces that appear in the captions?

I did try the following but no luck:

e.column.ColumnChooserHeaderCaption= e.column.FieldName;

Thanks.


Solution

  • DevExpress WPF Grid:

    //If this property is null the bound FieldName will be used with spaces between capitals
    BaseColumn.Header = "Custom Header";
    

    DevExpress WinForms Grid:

    //Same details apply if null as in WPF example
    GridColumn.Caption = "Custom Header";