Back to Devexpress

EditorButton.Caption Property

windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-editorbutton-4a4d412b.md

latest5.1 KB
Original Source

EditorButton.Caption Property

Gets or sets the caption text of the editor button.

Namespace : DevExpress.XtraEditors.Controls

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue("")]
[DXCategory("Appearance")]
public virtual string Caption { get; set; }
vb
<DefaultValue("")>
<DXCategory("Appearance")>
Public Overridable Property Caption As String

Property Value

TypeDefaultDescription
StringString.Empty

A string specifying button caption text.

|

Remarks

Text is displayed in the button if the EditorButton.Kind property is set to any of the following values: Glyph , Ellipsis , Delete , OK , Plus , Minus , Redo , Undo or DropDown.

To display only the caption without an image, set the EditorButton.Kind property to Glyph and do not assign any image to the button.

If the button displays a custom or predefined image and the EditorButton.ImageOptions.Location property is set to MiddleCenter , the text is not displayed, but the image is centered within the button.

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

winforms-grid-custom-button-caption-customrowcelledit-event/CS/WindowsApplication1/Form1.cs#L36

csharp
repositoryItem.Assign(defaultRepositoryItemButtonEdit);
repositoryItem.Buttons[0].Caption = String.Format("Find: {0}", value);
repositoryItemsCache[value] = repositoryItem;

winforms-custom-buttonedit-display-editvalue-on-button/CS/TestMyButtonEdit/MyButtonEdit.cs#L53

csharp
string str_value = EditValue as string;
    Properties.Buttons[1].Caption = (str_value == null ? string.Empty : str_value);
}

winforms-grid-toggle-row-visibility/CS/WindowsApplication1/Form1.cs#L46

csharp
button.Enabled = !(spinEdit1.EditValue == null);
button.Caption = rowVisibilityHelper1.IsRowInvisible(GetButtonEditValue()) ? "Show" : "Hide";

winforms-grid-custom-button-caption-customrowcelledit-event/VB/WindowsApplication1/Form1.vb#L42

vb
repositoryItem.Assign(defaultRepositoryItemButtonEdit)
repositoryItem.Buttons(0).Caption = String.Format("Find: {0}", value)
repositoryItemsCache(value) = repositoryItem

winforms-grid-toggle-row-visibility/VB/WindowsApplication1/Form1.vb#L44

vb
If rowVisibilityHelper1.IsRowInvisible(GetButtonEditValue()) Then
    button.Caption = "Show"
Else

winforms-custom-buttonedit-display-editvalue-on-button/VB/TestMyButtonEdit/MyButtonEdit.vb#L45

vb
Dim str_value As String = TryCast(EditValue, String)
    Properties.Buttons(1).Caption = (If(str_value Is Nothing, String.Empty, str_value))
End If

See Also

ImageOptions

Kind

EditorButton Class

EditorButton Members

DevExpress.XtraEditors.Controls Namespace