Skip to main content

BaseLayoutItem.Text Property

Gets or sets the caption of this layout item. If the Text property is null (Nothing in VB.NET) or String.Empty, this property returns the item name.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v23.1.dll

NuGet Package: DevExpress.Win.Navigation


public virtual string Text { get; set; }

Property Value

Type Description

A string that is the layout item’s text.


This property specifies the text that is associated with the layout item. For LayoutControlItem items this text is displayed next to the item’s control. For LayoutControlGroup items the Text string represents the group’s caption.

To hide or display the text, use the BaseLayoutItem.TextVisible Boolean property. For LayoutControlItem items, the text region’s size can be modified with the BaseLayoutItem.TextSize property. For instance, you can use this property to allocate more space to the text region.


Do not set the Text property to null or String.Empty. Doing so does not hide the item caption, the item shows its name instead. As a workaround, you can set the Text property to " " (space character).

A LayoutControlItem‘s text can be displayed at the left, top, right or bottom edge of the item’s control. To change the text position, use the BaseLayoutItem.TextLocation property.

The Text property allows you to specify a hotkey (ALT+Character) a user can press to focus the layout item’s control. Prefix the target Character with the ampersand symbol (‘&’). This character is underscored when the ALT key is pressed at runtime. For the following layout item, the Text property is set to “Contact &Name”:


If the LayoutControlItem.AllowHtmlStringInCaption property is set to true, you can use HTML tags to format the Text. For detailed information, see HTML Text Formatting.

To get the plain display text (without HTML tags and the ampersand symbols, if any), use the BaseLayoutItem.GetDisplayText method.


The following example shows how to format the BaseLayoutItem.Text using HTML tags. HTML formatting is enabled via the LayoutControlItem.AllowHtmlStringInCaption property.


layoutControlItem1.Text = "<size=14>Size = 14 <u>Underline</u> <br> <size=11>Size = 11 <color=255, 0, 0>Red";
layoutControlItem1.AllowHtmlStringInCaption = true;
// Increase the control's height
layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
layoutControlItem1.MinSize = new Size(layoutControlItem1.MinSize.Width, 50);
layoutControlItem1.AppearanceItemCaption.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
See Also