Back to Devexpress

XRControl.TextAlignment Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-d551a24b.md

latest6.1 KB
Original Source

XRControl.TextAlignment Property

Specifies the positioning of text within a control.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[SRCategory(ReportStringId.CatAppearance)]
public virtual TextAlignment TextAlignment { get; set; }
vb
<SRCategory(ReportStringId.CatAppearance)>
Public Overridable Property TextAlignment As TextAlignment

Property Value

TypeDescription
TextAlignment

A TextAlignment enumeration value that specifies how the text is aligned within the control.

|

Available values:

Show 12 items

NameDescription
TopLeft

The text is vertically aligned at the top, and horizontally aligned on the left.

| | TopCenter |

The text is vertically aligned at the top, and horizontally aligned at the center.

| | TopRight |

The text is vertically aligned at the top, and horizontally aligned on the right.

| | MiddleLeft |

The text is vertically aligned in the middle, and horizontally aligned on the left.

| | MiddleCenter |

The text is vertically aligned in the middle, and horizontally aligned at the center.

| | MiddleRight |

The text is vertically aligned in the middle, and horizontally aligned on the right.

| | BottomLeft |

The text is vertically aligned at the bottom, and horizontally aligned on the left.

| | BottomCenter |

The text is vertically aligned at the bottom, and horizontally aligned at the center.

| | BottomRight |

The text is vertically aligned at the bottom, and horizontally aligned on the right.

| | TopJustify |

The text is vertically aligned at the top, and horizontally justified.

This mode is ignored in Silverlight applications.

| | MiddleJustify |

The text is vertically aligned in the middle, and horizontally justified.

This mode is ignored in Silverlight applications.

| | BottomJustify |

The text is vertically aligned at the bottom, and horizontally justified.

This mode is ignored in Silverlight applications.

|

Remarks

The TextAlignment property determines how the text is positioned relative to the control edges.

If the TextAlignment property value is not set for the current report control, its value is taken from its parent. The TextAlignment value of the current control applies to all of its child report controls (if any – in the XRControl.Controls collection) if the TextAlignment property for the child controls is not specified. For more information on this concept, review the following help topic: Appearance Properties.

Not all XRControl class descendants use the TextAlignment property. This property is not available for the XRPageBreak class.

The horizontal alignment specified by the TextAlignment property is ignored when the XRLabel.AutoWidth property is set to true.

When the Justify alignment is used, all lines except for the last line of the paragraph are aligned. Thus, if the paragraph consists of one line, the output is identical to the Left alignment.

The following code snippets (auto-collected from DevExpress Examples) contain references to the TextAlignment 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.

reporting-winforms-appearance-settings/CS/XtraReport1.cs#L47

csharp
label.ForeColor = Color.White;
    label.TextAlignment = TextAlignment.MiddleRight;
}

reporting-wpf-use-private-custom-font-distributed-with-application/VB/PrivateFontDemo/SampleReport.vb#L32

vb
Detail.Padding = New DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F)
Detail.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft
'

reporting-winforms-appearance-settings/VB/XtraReport1.vb#L36

vb
label.ForeColor = Color.White
    label.TextAlignment = TextAlignment.MiddleRight
End Sub

See Also

Appearance Properties

Report Visual Styles

Conditionally Change the Control's Appearance

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace