How to: Change the Field Value Header Appearance

If UserLookAndFeel.Style is set to Skin, the appearance background color settings have no effect. To set a custom background color, draw the field header manually in the PivotGridControl.CustomDrawFieldValue event handler.

pivot-customdrawfieldvalue

NOTE

The complete sample project How to Change the Field Value Header Background with the CustomDrawFieldValue Event is available in the DevExpress Examples repository.

private void pivotGridControl1_CustomDrawFieldValue(object sender, 
    DevExpress.XtraPivotGrid.PivotCustomDrawFieldValueEventArgs e) {
    if (e.Area == DevExpress.XtraPivotGrid.PivotArea.ColumnArea) {
        e.Appearance.BackColor = Color.GreenYellow;
    }
    else if (e.Area == DevExpress.XtraPivotGrid.PivotArea.RowArea) {
        e.Painter.DrawObject(e.Info);
        e.Painter.DrawIndicator(e.Info);
        e.GraphicsCache.FillRectangle(e.GraphicsCache.GetSolidBrush(Color.FromArgb(50, 0, 0, 200)), e.Bounds);
        e.Handled = true;
    }
}