Random color for sfdatagrid background

Hi guys,

I have my sfdatagrid items from datatable.

How can I change a background color for each similar item.

Common sample shows like grid.background=color.red this code is specific to red only.

What i want to show is grid.background= randomcolor. And each color correspond to an item?

Pls help.

1 Reply 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team June 2, 2020 02:58 PM UTC

Hi Mark Jayvee,

Thank you for contacting Syncfusion support. 
Your requirement can be achieved by using SfDataGrid.QueryRowStyle and SfDataGrid.QueryCellStyle events in SfDataGrid. For more information, please refer the below UG link,

UG Link: https://help.syncfusion.com/windowsforms/datagrid/conditionalstyling#rows 
https://help.syncfusion.com/windowsforms/datagrid/styling

We hope this helps. Please let us know, if you require further assistance on this. 
Regards,
Vijayarasan S 


Marked as answer
Loader.
Up arrow icon