Skip to main content

ButtonEdit.PerformClick(EditorButton) Method

Simulates a click on the specified editor button.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v25.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public void PerformClick(
    EditorButton button
)

Parameters

Name Type Description
button EditorButton

The editor button to click.

Remarks

The PerformClick method raises ButtonClick and ButtonPressed events for the specified button.

The following code snippet simulates a click on the first editor button:

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

// Subscribe to events.
buttonEdit1.ButtonClick += ButtonEdit1_ButtonClick;
buttonEdit1.ButtonPressed += ButtonEdit1_ButtonPressed;

// Get the first button.
EditorButton firstButton = buttonEdit1.Properties.Buttons[0];

// Simulate a user click on the button.
buttonEdit1.PerformClick(firstButton);

void ButtonEdit1_ButtonClick(object sender, ButtonPressedEventArgs e) {
    // Display which button triggered the event.
    XtraMessageBox.Show($"ButtonClick fired for: {e.Button.Kind}");
}

void ButtonEdit1_ButtonPressed(object sender, ButtonPressedEventArgs e) {
    // Display which button triggered the event.
    XtraMessageBox.Show($"ButtonPressed fired for: {e.Button.Kind}");
}
See Also