Skip to main content

XtraReport.FormattingRuleSheet Property

Provides access to a collection of formatting rules stored in a report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core


public FormattingRuleSheet FormattingRuleSheet { get; }

Property Value

Type Description

A FormattingRuleSheet object, that represents the collection of FormattingRule objects.


A formatting rule in XtraReports is represented by objects of a FormattingRule type. These objects are stored in a report’s collection returned by the FormattingRuleSheet property.

For more information on using this property, refer to the Conditionally Changing a Control’s Appearance document.


Formatting rules are only available in the legacy binding mode (when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Bindings). See Shaping Data using Expression Bindings to learn about the recommended approach to shaping report data.


This example demonstrates how to conditionally change a control’s appearance at runtime. For this, it is necessary to create an instance of the FormattingRule class, specify its FormattingRule.Condition and FormattingRule.Formatting properties and add this object to a report’s sheet of formatting rules (XtraReport.FormattingRuleSheet) and to the collection of formatting rules of a control or a band, to which it should be applied (XRControl.FormattingRules). Note that the same task can be also solved at design time, as described in the Conditionally Changing a Control’s Appearance topic.

using System.Drawing;
using System.Drawing.Printing;
using DevExpress.XtraReports.UI;
// ...

private void XtraReport1_BeforePrint(object sender, CancelEventArgs e) {
    // Create a new rule and add it to a report.
    FormattingRule rule = new FormattingRule();

    // Specify the rule's properties.
    rule.DataSource = this.DataSource;
    rule.DataMember = this.DataMember;
    rule.Condition = "[UnitPrice] >= 30";
    rule.Formatting.BackColor = Color.WhiteSmoke;
    rule.Formatting.ForeColor = Color.IndianRed;
    rule.Formatting.Font = new Font("Arial", 10, FontStyle.Bold);

    // Apply this rule to the detail band.
See Also