Skip to main content
A newer version of this page is available. .

Label

  • 3 minutes to read

This document describes the XRLabel control and illustrates its main features.

This topic consists of the following sections:

Label Overview

The XRLabel control displays plain text in a report. You can add this control by dragging the XRLabel item from the DX:17.2: Report Controls Toolbox tab onto the report.

report-control-label-0

Use the XRControl.Text property to specify the label’s text. You can double-click the label to invoke its in-place editor and type the desired text.

xrlabel-inplace-editor

Data Binding

Display Field Values

You can bind the label’s Text property to a data field obtained from a report’s data source. Click the control’s smart tag, expand the Expression drop-down list and select the required data field.

report-control-label-3

Clicking the Expression option’s ellipsis button invokes the Expression Editor, in which you can construct a complex binding expression involving two or more data fields.

label-text-expression-binding

You can also drag and drop a numeric or text field from the Field List to create a new label bound to this field.

report-control-label-2

See the Binding Report Controls to Data topic to learn more about available data binding modes and creating data-aware controls.

The XRLabel.ProcessDuplicatesMode, XRLabel.ProcessDuplicatesTarget and XRLabel.ProcessNullValues options enable you to suppress a control when a duplicated or null value appears in an assigned data source.

You can also specify a format for output values using the XRCheckBox.TextFormatString property.

Display Summaries

You can make the label display a summary function’s result by setting the XRSummary.Running property to the required range and selecting the summary function in the Summary Expression Editor.

xrlabel-summary

Layout Settings

The XRLabel.CanGrow and XRLabel.CanShrink properties allow you to increase or decrease the control’s height according to its content’s size.

CanGrow = true CanGrow = false
cangrow-true cangrow-false
CanShrink = true CanShrink = false
canshrink-true canshrink-false

The XRLabel.AutoWidth property specifies whether to adjust a data-bound label’s width to its content automatically. See the Laying Out Dynamic Report Contents topic for more information.

Use the XRLabel.RightToLeft option to align the control text for right-to-left writing systems.

Interactivity

You can enable editing a label’s content in Print Preview by setting the EditOptions.Enabled option to true.

editing-fields-label-edit-options-new

Clicking this label in a previewed document invokes the appropriate editor.

EditOptions_StandardMemoEditor

Use the label’s XRLabel.InteractiveSorting option to enable sorting report data by clicking this label in Print Preview. Set the SortingOptions.TargetBand property to the required Group Header or Detail band, and the SortingOptions.FieldName property to the corresponding data field.

interactive-sorting-header

Refer to Sorting a Report in Print Preview for a step-by-step tutorial.

See Also