Skip to main content

ButtonEdit() Constructor

Initializes a new instance of the ButtonEdit class.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v26.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public ButtonEdit()

Example

The following code snippet creates a ButtonEdit control, customizes its buttons, and places the editor onto the form:

using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;

namespace DXApplication {
    public partial class Form1 : XtraForm {
        public Form1() {
            InitializeComponent();

            // Create a `ButtonEdit` and add it to the form.
            ButtonEdit btnEdit1 = new ButtonEdit() {
                Width = 200
            };

            // Configure the default (first) button as an OK button.
            btnEdit1.Properties.Buttons[0].Kind = ButtonPredefines.OK;

            // Add an additional button and treat it as a Delete action.
            btnEdit1.Properties.Buttons.Add(new EditorButton(ButtonPredefines.Delete));

            // Add the editor to the form's controls collection.
            this.Controls.Add(btnEdit1);

            // Handle button clicks.
            btnEdit1.ButtonClick += BtnEdit1_ButtonClick;
        }
        void BtnEdit1_ButtonClick(object sender, ButtonPressedEventArgs e) {
            ButtonEdit editor = sender as ButtonEdit;
            if (e.Button.Kind == ButtonPredefines.OK) {
                // OK button pressed.
                //...
            }
            if (e.Button.Kind == ButtonPredefines.Delete) {
                // Delete button pressed.
                //...
            }
        }
    }
}

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