Back to Devexpress

RepositoryItemButtonEdit.Buttons Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitembuttonedit-3e59e68d.md

latest5.0 KB
Original Source

RepositoryItemButtonEdit.Buttons Property

Returns the collection of buttons in the current button editor.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Behavior")]
public virtual EditorButtonCollection Buttons { get; }
vb
<DXCategory("Behavior")>
Public Overridable ReadOnly Property Buttons As EditorButtonCollection

Property Value

TypeDescription
EditorButtonCollection

The EditorButtonCollection object providing access to buttons for the button editor.

|

Remarks

The Buttons property enables you to add and remove buttons and access individual buttons in the collection and their properties. The number of buttons is determined by the Count property.

Each button represents an object of the EditorButton class and this allows you to customize the button by specifying its caption, image to display, button’s kind, style, visibility status etc.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Buttons 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-show-editor-buttons-on-cell-hover/CS/WindowsApplication3/Form1.cs#L44

csharp
textRect.Offset(e.Bounds.X, e.Bounds.Y);
EditorButtonObjectInfoArgs args = new EditorButtonObjectInfoArgs(e.Cache, info.Item.Buttons[0], e.Appearance);
Rectangle minBounds = info.EditorButtonPainter.CalcObjectMinBounds(args);

winforms-create-data-bound-imagecombobox/CS/Form1.cs#L59

csharp
{
    EditorButton button = gridLookUpEdit1.Properties.Buttons[buttonIndex];
    button.Visible = !(selectedImage == null);

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

csharp
{
    EditorButton button = spinEdit1.Properties.Buttons[1];
    button.Enabled = !(spinEdit1.EditValue == null);

winforms-grid-show-editor-buttons-on-cell-hover/VB/WindowsApplication3/Form1.vb#L47

vb
textRect.Offset(e.Bounds.X, e.Bounds.Y)
Dim args As New EditorButtonObjectInfoArgs(e.Cache, info.Item.Buttons(0), e.Appearance)
Dim minBounds As Rectangle = info.EditorButtonPainter.CalcObjectMinBounds(args)

winforms-create-data-bound-imagecombobox/VB/Form1.vb#L50

vb
Private Sub SetButtonImage(ByVal selectedImage As Image, ByVal buttonIndex As Integer)
    Dim button As EditorButton = gridLookUpEdit1.Properties.Buttons(buttonIndex)
    button.Visible = Not selectedImage Is Nothing

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

vb
Private Sub UpdateButtonEdit()
    Dim button As EditorButton = spinEdit1.Properties.Buttons(1)
    button.Enabled = Not(spinEdit1.EditValue Is Nothing)

See Also

EditorButton

RepositoryItemButtonEdit Class

RepositoryItemButtonEdit Members

DevExpress.XtraEditors.Repository Namespace