Try this
In the XAML
<Window.Resources>
<Style TargetType="{x:Type DataGridRow}">
<Style.Setters>
<Setter Property="Background" Value="{Binding Path=StatusColor}"></Setter>
</Style.Setters>
</Style>
</Window.Resources>
In the datagrid
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" Name="dtgTestColor" ItemsSource="{Binding}" >
<DataGrid.Columns>
<DataGridTextColumn Header="Valor" Binding="{Binding Path=Valor}"/>
</DataGrid.Columns>
</DataGrid>
In the code i have a class with
public class ColorRenglon
{
public string Valor { get; set; }
public string StatusColor { get; set; }
}
When set the DataContext
dtgTestColor.DataContext = ColorRenglon;
dtgTestColor.Items.Refresh();
If you have not set the color of the row the default value is Grey
Try this sample
with this sample
List<ColorRenglon> test = new List<ColorRenglon>();
ColorRenglon cambiandoColor = new ColorRenglon();
cambiandoColor.Valor = "Aqui va un color";
cambiandoColor.StatusColor = "Red";
test.Add(cambiandoColor);
cambiandoColor = new ColorRenglon();
cambiandoColor.Valor = "Aqui va otro color";
cambiandoColor.StatusColor = "PaleGreen";
test.Add(cambiandoColor);