BaseLayoutItem.Text Property

Gets or sets the text associated with the layout item.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v20.1.dll

Declaration

[XtraSerializableProperty]
[Bindable(true)]
[DXCategory("Text")]
public virtual string Text { get; set; }
<XtraSerializableProperty>
<Bindable(True)>
<DXCategory("Text")>
Public Overridable Property Text As String

Property Value

Type Description
String

A string that specifies the layout item's text.

Remarks

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.

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":

ItemLabel_Shortcut

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.

Examples

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

layoutItem_HTML_formatting

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