Change datagrid rows color depending of a value

In this post I will show you how to change the rows color of your Datagrid depending of a text from a column, for instance if a specific column has the value "Failed" the row will be in Red.

What do I want ?

I have a datagrid that displays a list of computers deployment status. 
I have three case of status:
- Success
- Running
- Failed

See below the datagrid before applying colors.
Datagrid before applying colors
Now I want to put the row in a specific color depending of those values.
- Success ==> Green
- Running ==> Blue
- Failed ==> Red

See below the Datagrid after applying colors
Datagrid after applying colors

See below the XAML part used before

See below the XAML part used after to apply colors
XAML 7639019920389805993

Enregistrer un commentaire

Accueil item


Join me soon

Join me soon

Endpoint Manager award

Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR