1、

<Grid Margin="10">
        <controls:DataGrid FontSize="12" Margin="0,10,0,0" VerticalAlignment="Stretch" CanUserAddRows="False"
                           AutoGenerateColumns="False" IsReadOnly="True" LoadingRow="DataGrid_LoadingRow"
                           x:Name="dataGrid">
            <controls:DataGrid.Columns>
                <!--<controls:DataGridTextColumn Header="id" Binding="{Binding id}" Width="*" />-->
                <controls:DataGridTextColumn Header="客戶" Binding="{Binding EndCustomer}" Width="*" />
                <controls:DataGridTextColumn Header="單號" Binding="{Binding OrderNo}" Width="*" />
                <controls:DataGridTextColumn Header="流程" Binding="{Binding Process}" Width="*" />
                <controls:DataGridTextColumn Header="狀態" Binding="{Binding State}" Width="*" />
            </controls:DataGrid.Columns>
        </controls:DataGrid>
    </Grid>

2、

private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            dynamic item  = e.Row.Item;
            if (item!=null)
            {
//                item.id = e.Row.GetIndex() + 1;
                if (item.State.ToString().Equals("待處理"))
                {
//                    e.Row.Background = new SolidColorBrush(Colors.Red);
                    e.Row.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#ff7575"));
                    
                }
            } 
        }

3、效果

WPF DataGrid 按某列的值设置背景颜色(LoadingRow方式)_代码