SfDataGrid displays all the text values in GridCells with a default Foreground color of RGB values 51. However SfDataGrid allows you to customize the Foreground color of the GridCells for the entire view and also to some specific cells based on conditions.
To change the Foreground color of the GridCells for the entire view, you can use the SfDataGrid.GridStyle property and set the custom style to change the foreground color. For more details please refer our user documentation in the below link.
In case, if your requirement is to change the Foreground color based on the cell value, then you can achieve this by creating custom GridCell derived from GridCell in SfDataGrid.
Refer the below code example for loading views inside the GridCell to customize its Foreground color based on cell value. The foreground of the GridCells of the Percentage column are applied with red color for values < 50 and green color for values > 50.
Refer the following screenshot for the final outcome upon execution of the above code
The working sample for this KB is available in the following location.
This page will automatically be redirected to the sign-in page in 10 seconds.