Is there a way, using XAML, to dynamically set the background of a row based on the content of one of it's cells?
Thanks,
Phil
You can define a style for a row and change the color using DataTrigger. Something like this:
<DataGrid>
    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow">
            <Style.Triggers>
                <DataTrigger Binding="{Binding BooleanPropertyOnObjectBoundToRow}" Value="True">
                   <Setter Property="Background" Value="Red"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </DataGrid.RowStyle>
</DataGrid>
Here BooleanPropertyOnObjectBoundToRow is a boolean property on your data object one the cells is bound to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With