2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Replace the default rowheader triangle icon with another iconBy default, GridDataBoundGrid displays a triangle in the row header cell of the currently selected row. Refer to the following screenshot. Solution You can achieve this by changing the row header BaseStyleMap to Header and handling the PrepareViewStyleInfo events. In PrepareViewStyleInfo, you can also change the e.Style.Text (for text) or the e.Style.BackgroundImage (for images). Refer to the following code example for changing BaseStyleMap. C# private void Form1_Load(object sender, System.EventArgs e) { this.gridDataBoundGrid1.BaseStylesMap["Row Header"].StyleInfo.CellType = "Header"; // BackgroundImageMode used to size to fit the image within the cell rectangle. this.gridDataBoundGrid1.BaseStylesMap["Row Header"].StyleInfo.BackgroundImageMode = GridBackgroundImageMode.StretchImage; this.gridDataBoundGrid1.PrepareViewStyleInfo += new Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventHandler(this.gridDataBoundGrid1_PrepareViewStyleInfo); } VB Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.gridDataBoundGrid1.BaseStylesMap("Row Header").StyleInfo.CellType = "Header" Me.gridDataBoundGrid1.BaseStylesMap("Row Header").StyleInfo.BackgroundImageMode = GridBackgroundImageMode.StretchImage AddHandler gridDataBoundGrid1.PrepareViewStyleInfo, AddressOf gridDataBoundGrid1_PrepareViewStyleInfo End Sub Refer to the following code example for changing text or image in PrepareViewStyleInfo. C# private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { if(e.ColIndex == 0 && this.gridDataBoundGrid1.CurrentCell.HasCurrentCellAt(e.RowIndex)) { e.Style.BackgroundImage = SystemIcons.Warning.ToBitmap(); } } VB Private Sub gridDataBoundGrid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles gridDataBoundGrid1.PrepareViewStyleInfo If e.ColIndex = 0 AndAlso Me.gridDataBoundGrid1.CurrentCell.HasCurrentCellAt(e.RowIndex) Then e.Style.BackgroundImage = SystemIcons.Asterisk.ToBitmap() End If End Sub The following screenshot displays the RowHeader replaced with another image and text. |
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.