Color row if Column value is not empty

What conditional formatting expression should be used to color a row if a column is not null or whitespace/contains text?

Thanks


1 Reply

MA Manikanda Akash Munisamy Syncfusion Team October 18, 2024 03:40 PM UTC

Hi ollie,

We have reviewed your scenario regarding applying conditional formatting to rows based on expressions. This can be achieved using the GridConditionalFormatDescriptor. We have prepared a sample demonstrating this approach. Please refer to the attached sample for the implementation.


Code Snippet
            GridConditionalFormatDescriptor format1 = new GridConditionalFormatDescriptor();
            format1.Appearance.AnyRecordFieldCell.Interior = new BrushInfo(Color.FromArgb(255, 191, 52));
            format1.Appearance.AnyRecordFieldCell.TextColor = Color.Black;
            format1.Expression = "[QuantityPerUnit] LIKE ''";
            format1.Name = "ConditionalFormat 1";
            gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(format1);

            GridConditionalFormatDescriptor format2 = new GridConditionalFormatDescriptor();
            format2.Appearance.AnyRecordFieldCell.Interior = new BrushInfo(Color.FromArgb(102, 110, 152));
            format2.Appearance.AnyRecordFieldCell.TextColor = Color.White;
            format2.Expression = " [QuantityPerUnit] LIKE '*\'";
            gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(format2);

Additionally, kindly refer to the following User Guide Documentation for more information:
 
If we have misunderstood your request or if your requirements are different, kindly provide more details about the issue. This will help us better understand the problem and provide an appropriate solution.

Thank you for your understanding and cooperation.

Regards,
Manikanda Akash 

Attachment: GridGroupingControl_Demo4_8_2ef4eb68.zip

Loader.
Up arrow icon