Skip to main content

ButtonEdit() Constructor

Initializes a new ButtonEdit control instance.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public ButtonEdit()

Remarks

Use the constructor to create a standalone ButtonEdit control. This initializes all properties to their default values. The editor is created with a single button (of type ButtonPredefines.Ellipsis). The ButtonEdit.Properties property allows you to customize the editor’s appearance and behavior.

To create a button editor inplace for XtraGrid, for instance, you should create a corresponding repository item of the RepositoryItemButtonEdit class and assign it to a column.

Example

The following code creates a ButtonEdit control and places it onto a panel:

The code changes the button collection as follows:

The example subscribes to the ButtonEdit.ButtonClick event to respond to button clicks.

ButtonEdit1_creating_example.gif

ButtonEdit btnEdit1 = new ButtonEdit();
btnEdit1.Width = 100;
btnEdit1.Properties.Buttons[0].Kind = ButtonPredefines.OK;
btnEdit1.Properties.Buttons.Add(new EditorButton(ButtonPredefines.Delete));
panel1.Controls.Add(btnEdit1);

btnEdit1.ButtonClick += BtnEdit1_ButtonClick;

private void BtnEdit1_ButtonClick(object sender, ButtonPressedEventArgs e) {
    ButtonEdit editor = sender as ButtonEdit;
    if(e.Button.Kind == ButtonPredefines.OK) {
        //...
    }
    if (e.Button.Kind == ButtonPredefines.Delete) {
        //...
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ButtonEdit() constructor.

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.

See Also