Skip to main content

XRControl.ForeColor Property

Gets or sets the control’s foreground color.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core


public virtual Color ForeColor { get; set; }

Property Value

Type Description

A Color object that represents the foreground color.


The ForeColor property specifies the control’s foreground color (e.g. the color of the text in XRLabel or the color of the line in XRLine), while the control’s background color is specified by its XRControl.BackColor property.

If the ForeColor property’s value is not set for the current report control, its value is obtained from its parent, or a parent of its parent and so on. Similarly, the ForeColor value of the current control is applied to all its child report controls (if there are any in its XRControl.Controls collection), if their ForeColor property value is not set. For more information on this concept, please refer to Appearance Properties.


The ForeColor property is used only by some descendants of the XRControl class. For example, the XRPageBreak class ignores the ForeColor property.


This example demonstrates how to use the XRLabel control to create a hyperlink.

The code below creates the XRLabel control, sets up its appearance, and specifies its NavigateUrl and Target properties.

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

public XRLabel CreateHyperlink(){
    // Create a label for a hyperlink.
    XRLabel hyperlinkLabel = new XRLabel();

    // Set its main properties.
    hyperlinkLabel.Text = "DevExpress Inc.";
    hyperlinkLabel.Width = 200;
    hyperlinkLabel.ForeColor = Color.Blue;
    hyperlinkLabel.Font = new Font("Tahoma", 12, FontStyle.Underline);

    // Set its URL and target.
    hyperlinkLabel.NavigateUrl = "";
    hyperlinkLabel.Target = "_blank";

    return hyperlinkLabel;

To add the hyperlink to the report’s Detail band, handle the report’s BeforePrint event:

using DevExpress.XtraReports.UI;
// ...

private void XtraReport1_BeforePrint(object sender, System.ComponentModel.EventArgs e) {
    // Create a new hyperlink and add it to the report's Detail Band.

The label behaves like a hyperlink in a report’s Print Preview and in a document exported to HTML, PDF, RTF, XLS, and XLSX formats.

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


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.

See Also