2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Image index and listWhen you use the ImageIndex and ImageList properties to set the icons, these properties only work for the TextBox and Static cells. So, make your header cell as static and then set your ImageIndex. For the DataBoundGrid, you have to use the PrepareViewStyleInfo to set these properties. GridControl: C# private void Form1_Load(object sender, System.EventArgs e) { this.gridControl1[0,2].CellType = "Static"; this.gridControl1[0,2].Text = "B"; this.gridControl1[0,2].CellAppearance = GridCellAppearance.Raised; this.gridControl1[0,2].ImageList = imageList; this.gridControl1[0,2].ImageIndex = 1; } VB Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.gridControl1(0,2).CellType = "Static" Me.gridControl1(0,2).Text = "B" Me.gridControl1(0,2).CellAppearance = GridCellAppearance.Raised Me.gridControl1(0,2).ImageList = imageList Me.gridControl1(0,2).ImageIndex = 1 End Sub GridDataBoundGrid: Refer to the following code example for setting the image in the header of the GridDataBoundGrid by using PrepareViewStyleInfo. C# private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { if(e.RowIndex == 0 ) { e.Style.CellType = "Static"; e.Style.CellAppearance = GridCellAppearance.Raised; if(e.ColIndex == 1) { e.Style.ImageList = imageList; e.Style.ImageIndex = 0; } if(e.ColIndex == 2) { e.Style.ImageList = imageList; e.Style.ImageIndex = 1; } if(e.ColIndex == 3) { e.Style.ImageList = imageList; e.Style.ImageIndex = 2; } } } VB Private Sub gridDataBoundGrid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles gridDataBoundGrid1.PrepareViewStyleInfo If e.RowIndex = 0 Then e.Style.CellType = "Static" e.Style.CellAppearance = GridCellAppearance.Raised If e.ColIndex = 1 Then e.Style.ImageList = imageList e.Style.ImageIndex = 0 End If If e.ColIndex = 2 Then e.Style.ImageList = imageList e.Style.ImageIndex = 1 End If If e.ColIndex = 3 Then e.Style.ImageList = imageList e.Style.ImageIndex = 2 End If End If End Sub The following screenshots display the images in the header of the GridControl and GridDataBoundGrid. Samples: |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.