2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Conditional formattingThe formatting of a cell can be handled in the QueryCellStyleInfo event. The e.TableCellIdentity.MappingName and e.Style.CellValue properties can be used to check the particular column cell values. C# //Triggers event. this.gridGroupingControl1.QueryCellStyleInfo += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventHandler(this.gridGroupingControl1_QueryCellStyleInfo); private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e) { If(e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { // Checks for the column name when the cellvalue is greater than 5. if(e.TableCellIdentity.Column.MappingName == "Col1" && (int)e.Style.CellValue>5) { e.Style.BackColor=Color.LightBlue; e.Style.Format="##.00"; } } } VB 'Triggers event. Private Me.gridGroupingControl1.QueryCellStyleInfo += New Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventHandler(AddressOf Me.gridGroupingControl1_QueryCellStyleInfo) Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs) If(e.TableCellIdentity.TableCellType = GridTableCellType.RecordFieldCell OrElse e.TableCellIdentity.TableCellType = GridTableCellType.AlternateRecordFieldCell) 'Checks for the column name when the cellvalue is greater than 5. If e.TableCellIdentity.Column.MappingName = "Col1" AndAlso CInt(Fix(e.Style.CellValue))>5 Then e.Style.BackColor=Color.LightBlue e.Style.Format="##.00" End If End Sub
Figure 1: Conditional format applied to each cell in column “Col1” 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.