Hi James,
Thank you for your details.
The grid has no collection of records that satisfy a particular conditional format. The formatting for conditional formatting is determined
on demand as the record is drawn in the grid.
So, if you want a collection of such records, then you would have to loop through all the current records in the grid and check the
GridTableViewStyle to see if that particular record has the style applied to it.
Please refer the steps that show how this can be done.
1) This code sets up the formatting and additionally, puts a 1 in the Tag field of the row header cell.
GridConditionalFormatDescriptor gcfd = new GridConditionalFormatDescriptor();
gcfd.Expression = "[Col1] > [Col2]";
gcfd.Appearance.AnyRecordFieldCell.Enabled = false;
gcfd.Appearance.AnyCell.BackColor = Color.Red;
gcfd.Appearance.RowHeaderCell.Tag = 1; //mark the header cell
this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(gcfd);
2) Here is a button handler that loops through all records in the grid to test whether this "1" value is set in the header cell. It simply
points a particular field value in a listbox, but you could create an List or ArrayList of records that satisfy the filter.
private void button1_Click(object sender, EventArgs e)
{
foreach (GridRecord rec in gridGroupingControl1.Table.FilteredRecords)
{
int rowIndex = gridGroupingControl1.Table.DisplayElements.IndexOf(rec);
GridTableCellStyleInfo style = gridGroupingControl1.TableControl.GetTableViewStyleInfo(rowIndex, 0); //0 is row header
if (style.Tag != null && style.Tag.Equals(1))
{
listBox1.Items.Add(rec.GetValue("Col0"));
}
}
}
Please refer the sample which implements the above said feature:
http://websamples.syncfusion.com/samples/Grid.Windows/F67447/main.htmKindly let us know if you need any further assistance.
Thank you for using Syncfusion Products.
Best Regards,
Jeba.