First add styles to the report:
Add the databinding to the report (eg in beforeprint) for the detail band
// XPO Object
public class SampleAnalysisItem : XPCustomObject
{
[Browsable(false)]
[NonPersistent]
public string ReportStyleName => IsOffSpec ? "xrControlStyleOffspec" : "xrControlStyleNormal";
}
public class CustomReport : DevExpress.XtraReports.UI.XtraReport
{
public CustomReport()
{
BeforePrint += CustomReport_BeforePrint;
// set the datasource
DataSource = new List<SampleAnalysisItem>();
}
private void CustomReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
if (GetCurrentRow() is SampleAnalysis obj)
{
xrTableRow10.DataBindings.Add("StyleName", DataSource, nameof(SampleAnalysisItem.ReportStyleName));
}
}
}559600cookie-checkDevExpress Report Style binding