Back to Devexpress

XRControl.BackColor Property

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

latest7.9 KB
Original Source

XRControl.BackColor Property

Gets or sets a control’s background color.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[SRCategory(ReportStringId.CatAppearance)]
public virtual Color BackColor { get; set; }
vb
<SRCategory(ReportStringId.CatAppearance)>
Public Overridable Property BackColor As Color

Property Value

TypeDescription
Color

A Color object that is the background color. The default value is Transparent.

|

Remarks

The BackColor property sets the background color of the control.

If the BackColor property value is not specified, the control retrieves its value from the parent control.

Appearance properties specified for bands or panels propagate to child controls, even though they may not take effect for some report elements. An obvious example of this behavior is the DetailBand element, that has no visible border or background color, even though it passes appearance property settings to its child controls. Another example is the XRPageBreak control, that has the XRControl.BackColor property, but ignores its value during rendering.

Review the following help topic for more information: Appearance Properties.

If a report element has a style assigned to it, the priority of the properties defined by that style is determined by the StylePriority property. Note that if conditional formatting is involved, the appearance it defines has a higher priority.

The following code snippets (auto-collected from DevExpress Examples) contain references to the BackColor 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-change-label-appearance-in-beforeprint-event-handler/CS/XtraReport1.cs#L21

csharp
label.ForeColor = Color.White;
    label.BackColor = Color.Red;
}

asp-net-web-forms-grid-create-report-based-on-grid-layout/CS/WebApplication1/ReportHelper.cs#L62

csharp
report.Bands.Add(footerBand);
footerBand.BackColor = Color.LightGray;
foreach(ASPxSummaryItem item in aspxGridView1.GroupSummary) {

reporting-winforms-appearance-settings/CS/XtraReport1.cs#L41

csharp
private void ApplyAppearanceSettings(XRLabel label) {
    label.BackColor = Color.Orange;
    label.BorderColor = Color.DarkGray;

winforms-scheduler-print-appointments-using-reports/CS/PrintingViaReports/XtraReport1.cs#L47

csharp
Color curColor = Color.FromArgb(Int32.Parse(((XRLabel)sender).Text));
((XRLabel)sender).BackColor = curColor;
((XRLabel)sender).ForeColor = curColor;

asp-net-mvc-grid-create-report-based-on-grid-layout/CS/E4755/Models/ReportHelperMVC.cs#L80

csharp
l.LocationF = new PointF(initialGroupOffset + i * 10, 0);
l.BackColor = Color.Beige;
l.SizeF = new SizeF((report.PageWidth - (report.Margins.Left + report.Margins.Right)) - (initialGroupOffset + i * subGroupOffset), bandHeight);

reporting-winforms-change-label-appearance-in-beforeprint-event-handler/VB/XtraReport1.vb#L23

vb
label.ForeColor = Color.White
    label.BackColor = Color.Red
ElseIf total > 1000 Then

asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/ReportHelper.vb#L64

vb
report.Bands.Add(footerBand)
footerBand.BackColor = Color.LightGray
For Each item As ASPxSummaryItem In aspxGridView1.GroupSummary

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

vb
Private Sub ApplyAppearanceSettings(ByVal label As XRLabel)
    label.BackColor = Color.Orange
    label.BorderColor = Color.DarkGray

winforms-scheduler-print-appointments-using-reports/VB/PrintingViaReports/XtraReport1.vb#L49

vb
Dim curColor As Color = Color.FromArgb(Int32.Parse(DirectCast(sender, XRLabel).Text))
DirectCast(sender, XRLabel).BackColor = curColor
DirectCast(sender, XRLabel).ForeColor = curColor

asp-net-mvc-grid-create-report-based-on-grid-layout/VB/E4755/Models/ReportHelperMVC.vb#L76

vb
l.LocationF = New PointF(initialGroupOffset + i * 10, 0)
l.BackColor = Color.Beige
l.SizeF = New SizeF((report.PageWidth - (report.Margins.Left + report.Margins.Right)) - (initialGroupOffset + i * subGroupOffset), bandHeight)

See Also

Appearance Properties

Report Visual Styles

Conditionally Change the Control's Appearance

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace