Back to Devexpress

XRCrossBandBox Class

xtrareports-devexpress-dot-xtrareports-dot-ui-baa31b77.md

latest7.8 KB
Original Source

XRCrossBandBox Class

A box that can be drawn across several report bands.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public class XRCrossBandBox :
    XRCrossBandControl
vb
Public Class XRCrossBandBox
    Inherits XRCrossBandControl

Remarks

The XRCrossBandBox control allows you to draw rectangles across several bands (as opposed to the XRLine, XRShape and XRPanel controls, which can be used only within a single band). You can use the XRCrossBandBox control to highlight a report section that spans across multiple bands.

Drag the XRCrossBandBox item from the DX.25.2: Report Controls tab and drop the item onto the report area to add a cross-band box to a report.

Place the control’s start and end in complementary bands that appear on each page of the document. The following bands are complementary:

In other cases, the control’s behavior can differ from an expected result. In the error list, an XRE040 warning message appears as you design or preview a report. For more information, review the following help topic: Errors, Warnings, and Information Messages.

Create a Cross-Band Box in Code

The following example creates a cross-band box in code:

csharp
using DevExpress.XtraReports.UI;

// Create a report with "Detail", "TopMargin", and "BottomMargin" bands.
XtraReport report = new XtraReport() {
    Bands = {
        new DetailBand(),
        new TopMarginBand(),
        new BottomMarginBand()
    }
};

// Create a cross-band box.
XRCrossBandBox crossBandBox = new XRCrossBandBox() {
    // Specify start/end bands.
    StartBand = report.Bands[BandKind.TopMargin],
    EndBand = report.Bands[BandKind.BottomMargin],
    // Specify start/end points.
    StartPointF = new DevExpress.Utils.PointFloat(0F, 0F),
    EndPointF = new DevExpress.Utils.PointFloat(0F, 100F),
    // Customize a style.
    WidthF = 100F
};

// Add the box to the report's cross-band controls.
report.CrossBandControls.Add(crossBandBox);
vb
Imports DevExpress.XtraReports.UI

' Create a report with "Detail", "TopMargin", and "BottomMargin" bands.
Private report As New XtraReport() With {
    .Bands = {
        New DetailBand(),
        New TopMarginBand(),
        New BottomMarginBand()
    }
}

' Create a cross-band box.
Private crossBandBox As New XRCrossBandBox() With {
    .StartBand = report.Bands(BandKind.TopMargin),
    .EndBand = report.Bands(BandKind.BottomMargin),
    .StartPointF = New DevExpress.Utils.PointFloat(0F, 0F),
    .EndPointF = New DevExpress.Utils.PointFloat(0F, 100F),
    .WidthF = 100F
}

' Add the box to the report's cross-band controls.
report.CrossBandControls.Add(crossBandBox)

Limitations

  • The Expression bindings mode is not supported. Although bindings are available, they are not processed and have no effect. To solve your task, handle the report’s BeforePrint event.

  • If you do not place a cross-band box on paired bands, the box can be displayed incorrectly in the report document.

  • A cross-band box cannot start/end on a vertical band.

  • If the thickness of a cross-band box is less than 0.5 pixels, the box is not included in export files that have the following formats:

  • Setting CanShrink for a control that the XRCrossBandBox control overlaps has no effect because the XRCrossBandBox control does not shrink. In a table, consider using table borders instead of the XRCrossBandBox control.

  • CanShrink may not work if the control is in a band set as the StartBand or EndBand of an XRCrossBandBox. In this case, the band can not shrink, even if the control allows it.

Implements

IScriptable

Inheritance

Object MarshalByRefObject Component XRControl XRCrossBandControl XRCrossBandBox

See Also

XRCrossBandBox Members

XRCrossBandLine

DevExpress.XtraReports.UI Namespace