Back to Devexpress

XRControl.OddStyleName Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-c4fd702e.md

latest5.2 KB
Original Source

XRControl.OddStyleName Property

Gets or sets the style applied to the control when it displays an odd record from the bound data source.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[Browsable(false)]
public virtual string OddStyleName { get; set; }
vb
<Browsable(False)>
Public Overridable Property OddStyleName As String

Property Value

TypeDescription
String

The name of the style from the Styles collection.

|

Remarks

The odd style is the style applied to the control when it displays an odd record from the bound dataset:

csharp
if (CurrentRowIndex % 2 == 0) {  
    //Even  
}  
else {  
    //Odd  
}
vb
If CurrentRowIndex Mod 2 = 0 Then
    'Even  
Else
    'Odd  
End If

If the control consists of static rows, such as a static table with multiple rows, then even and odd styles do not apply.

You can find examples of even and odd styles in the following help sections:

The following code snippets (auto-collected from DevExpress Examples) contain references to the OddStyleName property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/CS/Form1.cs#L125

csharp
label.ExpressionBindings.Add(new ExpressionBinding("Text", "[" + ds.Tables[0].Columns[i].Caption + "]"));
label.OddStyleName = "OddStyle";
label.EvenStyleName = "EvenStyle";

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/CS/Report_at_Runtime/PivotReportGenerator.cs#L220

csharp
table.EvenStyleName = "EvenStyle";
    table.OddStyleName = "OddStyle";
}

reporting-winforms-create-report-dynamically-and-bind-it-to-dataset/VB/Form1.vb#L120

vb
label.ExpressionBindings.Add(New ExpressionBinding("Text", "[" & ds.Tables(0).Columns(i).Caption & "]"))
label.OddStyleName = "OddStyle"
label.EvenStyleName = "EvenStyle"

winforms-create-a-custom-exporter-for-pivotgridcontrol-with-xtrareport/VB/Report_at_Runtime/PivotReportGenerator.vb#L225

vb
table.EvenStyleName = "EvenStyle"
    table.OddStyleName = "OddStyle"
End If

See Also

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace