windowsforms-devexpress-dot-xtralayout-dot-baselayoutitem-a9ac8868.md
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.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[Bindable(true)]
[DXCategory("Text")]
[XtraSerializableProperty]
[XtraSerializablePropertyId(400)]
public virtual string Text { get; set; }
<XtraSerializableProperty>
<XtraSerializablePropertyId(400)>
<Bindable(True)>
<DXCategory("Text")>
Public Overridable Property Text As String
| Type | Description |
|---|---|
| String |
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.
Tip
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>
<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;
LayoutControlItem1.Text = "<size=14>Size = 14 <u>Underline</u>
<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
The following code snippets (auto-collected from DevExpress Examples) contain references to the Text 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.
int count = View.CollectionSource.GetCount();
layoutGroup.Text = DetailViewControllerHelper.ClearItemCountInTabCaption(layoutGroup.Text);
if(count > 0) {
winforms-richedit-layout-api/CS/Form1.cs#L51
#endregion #GetVisiblePages
lblPageInfo.Text = s;
}
winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/Form1.cs#L212
string exampleCode = codeEditor.ShowExample(oldExample, newExample);
codeExampleNameLbl.Text = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(newExample.RegionName) + " example";
CodeEvaluationEventArgs args = new CodeEvaluationEventArgs();
winforms-spreadsheet-pivot-table-api/CS/SpreadsheetPivotTableExamples/Form1.cs#L197
string exampleCode = codeEditor.ShowExample(oldExample, newExample);
codeExampleNameLbl.Text = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(newExample.RegionName) + " example";
CodeEvaluationEventArgs args = new CodeEvaluationEventArgs();
base.grpRecurrencePattern.Text =
"You can edit only daily recurring appointments";
winforms-richedit-layout-api/VB/Form1.vb#L41
' #End Region ' #GetVisiblePages
lblPageInfo.Text = s
End Sub
winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/Form1.vb#L206
Dim exampleCode As String = codeEditor.ShowExample(oldExample, newExample)
codeExampleNameLbl.Text = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(newExample.RegionName) & " example"
Dim args As New CodeEvaluationEventArgs()
winforms-spreadsheet-pivot-table-api/VB/SpreadsheetPivotTableExamples/Form1.vb#L189
Dim exampleCode As String = codeEditor.ShowExample(oldExample, newExample)
codeExampleNameLbl.Text = CodeExampleDemoUtils.ConvertStringToMoreHumanReadableForm(newExample.RegionName) & " example"
Dim args As New CodeEvaluationEventArgs()
grpRecurrencePattern.Text = "You can edit only daily recurring appointments"
Text = "Appointment Recurrence: Modified Form"
memoEditLayoutItem.TextLocation = Locations.Top
memoEditLayoutItem.Text = "Text:"
Dim memoEdit As New MemoEdit()
See Also
LayoutControlItem.TextAlignMode
OptionsItemTextGroup.TextAlignMode