Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Row background color based on data
posted

Is there an EASY way to change the background color of a row based on data in that row?

Any help will be appreciated. 

Parents
No Data
Reply
  • 2125
    posted

    Hi,

    You can easily change the background of a row(record) based on the value of one of its cells using style triggers.

    <igDP:XamDataGrid.Resources>
                    <Style TargetType="{x:Type igDP:DataRecordCellArea}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},
    Path= Record.Cells[1].Value}" Value="Sales">
                                <Setter Property="Background" Value="Orange" /> 
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </igDP:XamDataGrid.Resources>


    I have created and attached a working sample application, demonstrating this approach.

    Best Regards,
    Yanko

    ChangeRowBackgroundBasedOnData.zip
Children