BandFactory.CreateInstance(BandKind) Method

Creates a report band instance.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public virtual Band CreateInstance(
    BandKind bandKind
)
Public Overridable Function CreateInstance(
    bandKind As BandKind
) As Band

Parameters

Type Name Description
BandKind bandKind

A BandKind enumeration value.

Returns

Type Description
Band

A descendant of the Band class.

The following example illustrates how to use the BandFactory class for overriding the default behavior for adding new Page Headers to a report.

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

public class MyCustomPageHeaderBand : PageHeaderBand {
    public string MyCustomBandProperty { get; set; }
}

public class MyCustomBandFactory : BandFactory {
    public override Band CreateInstance(BandKind bandKind) {
        if (bandKind == BandKind.PageHeader)
            return new MyCustomPageHeaderBand();
        return base.CreateInstance(bandKind);
    }
}

To register a custom band factory, assign it to the protected static bandFactory property of the XtraReportBase class.

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

public class XtraReport1 : XtraReport {
    public XtraReport1() {
        InitializeComponent();
        bandFactory = new MyCustomBandFactory();
    }
}

See Also