Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Collapse]Reporting
 [Expand]Product Information
 [Collapse]Creating Reports in Visual Studio
  [Expand]Adding a Report to Your .NET Application
  [Expand]Getting Started with DevExpress Reporting
  [Collapse]Detailed Guide to DevExpress Reporting
   [Expand]Storing and Distributing Reports
   [Expand]Providing Data to Reports
   [Expand]Shaping Report Data
   [Collapse]Report Navigation, Interactivity and Appearance
    [Expand]Report Navigation
    [Expand]Report Interactivity
    [Collapse]Report Appearance
      Appearance Properties
      Report Visual Styles
      Storing Report Style Sheets
   [Expand]Reporting API
  [Expand]Detailed Guide to Visual Studio Report Designer
 [Expand]Creating End-User Reporting Applications
 [Expand]API Reference
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Report Visual Styles

This document describes the main concepts behind the implementation of styles in XtraReports. It introduces the style notion, describes how styles override control appearance properties, explains the odd-even styles feature and demonstrates how report styles can be stored within style sheets.

This document consists of the following sections.

Expanded Styles and Style Overriding

In addition to the ability to specify appearance property values for every control and band, it is possible to create a global style in a report. A style is represented by the XRControlStyle class instance and lives in a report's collection returned by the XtraReport.StyleSheet property.

To assign a particular style to a control, set its Styles.Style property at design time (or XRControl.StyleName property at runtime) to one of the styles stored in a report's style sheet collection.

Note

A style that is assigned to a band, in fact, applies to controls that the band contains (except for the controls that have their own appearance settings specified).

To access the style collection, you can also use the Report Explorer. Commands of the context menu allow you to add, edit or delete a style.

To apply a style to a report element, drag it from the Report Explorer onto the required report element.

A style defines the same appearance properties that are defined by a control's (or band's) appearance properties. So, if a certain property is set both in the styles and in the control's own appearance property, the priority is required for deciding which of the properties to use. The XRControl.StylePriority property is intended for this.

By default, all the Style Priority options (StylePriority.UseBackColor, StylePriority.UseBorderColor, etc.), which follow the structure of the style and appearance properties, are set to true (except the StylePriority.UseTextAlignment property). This means that if any style is assigned to a control using its Styles property, all its properties will have a higher priority than the properties stored in the control or in its parent. If you want some of the properties to be determined by a control, not by its style, set the corresponding Use* property to false.

The following image demonstrates how the XRControl.StylePriority property works.

If certain control appearance property values are changed at design time, the corresponding Use* property of the StylePriority object is set to false for this control. At runtime, you should explicitly set the corresponding Use* property of the StylePriority object to false.

Note

When using conditional formatting, the appearance defined by it has a higher priority than the properties described above.

Expanded Odd and Even Styles

You can assign different styles to alternating rows in a report.

Use the XRControl.OddStyleName and XRControl.EvenStyleName properties to apply these styles to a report control.

Expanded Style Sheets

At design time, you can use the Styles Editor to manage a report's style sheets, customize them, save to a file and load from it. So, it is possible to create several style sheets and load them either at design time or at runtime.

There are two ways of storing report style sheets. The first approach is to save them to external files (with REPSS extension) and then load them to a report using the report's XtraReport.StyleSheetPath property in the read-only mode (this is described at Storing Report Style Sheets). The second is to store the style sheets within the report (using the XtraReport.StyleSheet property), so that they can be modified, if required, and saved with the report itself.

Note

If styles contained in a style sheet loaded in the XtraReport.StyleSheetPath property have the same names as styles already contained in a report, the latter are overridden.

You can store report style sheets in an XML format, using the following methods: XRControlStyleSheet.SaveXmlToFile, XRControlStyleSheet.SaveXmlToStream and XRControlStyleSheet.LoadFromXml. See XML Serialization to learn more.

Expanded See Also

How would you rate this topic?​​​​​​​