Category / Section
How do I change the appearance of a single header cell?
1 min read
The GridDataBoundGrid supports to change the appearance of a single cell by using the PrepareViewStyleInfo event.
C#
//change the appearance of a second header cell if (e.ColIndex == 2 && e.RowIndex == 0) { e.Style.Font.Italic = true; e.Style.Font.Bold = true; e.Style.Font.Orientation = 5; e.Style.TextColor = Color.Red; }
VB
Private Sub gridDataBoundGrid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) 'change the appearance of a second header cell If e.ColIndex = 2 AndAlso e.RowIndex = 0 Then e.Style.Font.Italic = True e.Style.Font.Bold = True e.Style.Font.Orientation = 5 e.Style.TextColor = Color.Red End If End Sub
After applying the properties, the appearance of the header cell is displayed as follows.
Figure 1: Appearance of the header text changed
Sample Links