Back to Devexpress

XRControl.StyleName Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-7fd4dbb8.md

latest3.6 KB
Original Source

XRControl.StyleName Property

Gets or sets the name of the style, which is applied to the current control.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

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

Property Value

TypeDescription
String

A String representing the name of the style.

|

Remarks

The StyleName property is intended to provide the capability to define a control’s appearance by a certain style when a report is constructed at runtime via code. To do this, you first need to create an instance of the XRControlStyle object and set its appearance properties, then add this style to a report’s XtraReport.StyleSheet and finally assign its XRControlStyle.Name to the StyleName property of a particular report control or band.

For more information on using styles in XtraReports, refer to the Report Visual Styles document.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the StyleName 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-appearance-settings/CS/XtraReport1.cs#L27

csharp
private void xrLabel1_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e) {
    ((XRLabel)sender).StyleName = "MyStyle1";

reporting-winforms-appearance-settings/VB/XtraReport1.vb#L16

vb
Private Sub xrLabel1_BeforePrint(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
    CType(sender, XRLabel).StyleName = "MyStyle1"
End Sub

See Also

Report Visual Styles

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace