Hi Caleb,
Thank you for your interest in Syncfusion products.
How to access the cell from co-ordinates |
Please Find the below code snippet to get the row index and column index using co-ordinates. //To calculate Row and column index of specified point this.gridControl1.PointToRowCol(new Point(100, 100),out a,out b); | ||
Cell based formatting using QueryCellInfo |
To dynamically set the style properties on a cell, the QueryCellStyleInfo event has to be handled. You can access the row of the cell and check whether it is a RecordRow or not. Assuming the datasource as a DataTable, the GridRecordRow.Record.GetData method returns the data as a DataRowView object. Then by using the DataRowView, you can access the data in the row and after checking the conditions, change the style of the row. Refer to the following code example. C# 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) { //Disables the row when the value of Name in the same row is Row1. if (e.TableCellIdentity.RowIndex != -1) { GridRecordRow rec = this.gridGroupingControl1.Table.DisplayElements[e.TableCellIdentity.RowIndex]as GridRecordRow; if (rec != null) { // Applies format by checking the value ‘Row1’ DataRowView dr = rec.GetData() as DataRowView; if (dr != null && dr["Name"].Equals("Row1")) { e.Style.Enabled = false; e.Style.BackColor = Color.Azure; } } } }
Sample: | ||
Conditional formatting |
To conditionally set the style of a row in the GridGroupingControl, you can apply the row styles by using the Conditional Formatting function. You can refer to the following code example to apply Conditional Formatting to the records that have the cell value of Row1. C#
|
Regards,
Pavithra K.