XRLabel.AutoWidth Property
Specifies whether or not the width of a label depends on its text.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
[DefaultValue(false)]
[SRCategory(ReportStringId.CatBehavior)]
public bool AutoWidth { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | false | true, to automatically adjust the width to accommodate the label text; otherwise, false. |
Remarks
Use the AutoWidth property to always print an XRLabel‘s text in full, without limiting it by the control’s dimensions. This is often required if a label’s text is supplied from a data source and is not immediately available at Visual Studio design time (e.g., if a label has been assigned a summary function).
When using this feature, consider the following.
The result of using this option depends on the XRControl.WordWrap property value.
- if the WordWrap property is enabled, a label’s width can be only decreased;
- if the WordWrap property is disabled, a label’s width can either be increased or decreased to best fit a label’s contents.
- This option has no effect on the width or position of other report controls.
This option depends on the current horizontal alignment setting of a label (the XRControl.TextAlignment property value).
The following image illustrates how the AutoWidth works when the TextAlignment property is set to “left”.
The following image illustrates how the AutoWidth works when the TextAlignment property is set to “right”.
The following image illustrates how the AutoWidth works when the TextAlignment property is set to “center”.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AutoWidth 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.