Change datagrid rows color depending of a value

1 A+ A-

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


Learn KQL in one month


You want to support me ?

Mes articles en français

Books in French