DataGrid: Style row based on data

Nov 10, 2008 at 11:41 AM
Edited Nov 10, 2008 at 11:50 AM
I'm obviously being stupid as I can work this out.  I've got a datagrid and it has data in it.  I want to style the row depending on the data contained in the row.  I have this working on the Infragistics and Xceed grids and am looking to replicate this using the toolkit grid.

I have a boolean field in the data called IsDupe.  If it is true then I want the entire row to be red.  I'm guessing the path is wrong but for the life of me I just can't work it out.

Here is what I've tried....

<Style x:Key="RowStyle" TargetType="dg:DataGridRow" >
            <Setter Property="Background" Value="White"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDupe}" Value="True">
                    <Setter Property="Background" Value="Red" />
                </DataTrigger>
            </Style.Triggers>
</Style>


UPDATE:

I was being stupid.....

Here is what I should have used.

<Style x:Key="RowStyle" TargetType="dg:DataGridRow" >
            <Setter Property="Background" Value="White"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsDupe}" Value="True">
                    <Setter Property="Background" Value="Red" />
                </DataTrigger>
            </Style.Triggers>
</Style>