Skip to main content

ButtonEdit.ButtonClick Event

Occurs when a button editor’s button is clicked.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v22.2.dll

NuGet Package: DevExpress.Win.Navigation


public event ButtonPressedEventHandler ButtonClick

Event Data

The ButtonClick event's data class is ButtonPressedEventArgs. The following properties provide information specific to this event:

Property Description
Button Gets the button being pressed/clicked.


Use this event to perform actions when a user clicks an editor button. You can, for instance, activate a custom dropdown window, a dialog or perform calculations based on a value entered etc.

The editor’s ButtonClick event is equivalent to the RepositoryItemButtonEdit.ButtonClick event available via the ButtonEdit.Properties object, i.e. adding/removing an event handler for the current event actually affects the RepositoryItemButtonEdit.ButtonClick event.

Refer to the RepositoryItemButtonEdit.ButtonClick topic for more information.


This example assumes that a form contains a ButtonEdit control with two buttons.

The following code shows how to respond to clicking these buttons via the ButtonEdit.ButtonClick event.

The result of clicking the second button for a button edit control is displayed below:


using DevExpress.XtraEditors.Controls;

private void buttonEdit1_ButtonClick(object sender, ButtonPressedEventArgs e) {
    ButtonEdit editor = (ButtonEdit)sender;
    EditorButton Button = e.Button;
    string Info = "";
    string EOL = "\n";
    Info += " Kind: " + Button.Kind.ToString() + EOL;
    Info += " Caption: " + Button.Caption + EOL;
    Info += " Image assigned: " + (Button.Image != null).ToString() + EOL;
    Info += " Shortcut: " + Button.Shortcut.ToString() + EOL;
    Info += " IsLeft: " + Button.IsLeft.ToString() + EOL;
    Info += " Width: " + Button.Width.ToString() + EOL;
    Info += " Index: " + editor.Properties.Buttons.IndexOf(e.Button).ToString();

    XtraMessageBox.Show(Info, "ButtonClick event");
See Also