The event handler receives an argument of type ButtonPressedEventArgs containing data related to this event.
The following
ButtonPressedEventArgs properties provide information specific to this event.
Property |
Description |
Button |
Gets the button being pressed/clicked. |
Write a ButtonPressed event handler to perform actions in response to pressing an editor button.
The editor's ButtonPressed event is equivalent to the RepositoryItemButtonEdit.ButtonPressed event available via the Properties object, i.e. adding/removing an event handler for the current event actually affects the RepositoryItemButtonEdit.ButtonPressed event.
Refer to the RepositoryItemButtonEdit.ButtonPressed topic for more information.

Example
The following code shows a ButtonPressed event handler for a button edit control.
When the end-user presses the first button (button with index 0), the handler activates a custom dialog of class Form2. The form's constructor requires an edit value which will be edited in the dialog. After the form is successfully closed, the modified value is retrieved via the EditingValue property and assigned back to the editor's edit value.
C# |
using DevExpress.XtraEditors.Controls;
private void buttonEdit1_ButtonPressed(object sender, ButtonPressedEventArgs e) {
ButtonEdit editor = (ButtonEdit)sender;
int buttonIndex = editor.Properties.Buttons.IndexOf(e.Button);
if (buttonIndex == 0) {
Form2 form = new Form2(editor.EditValue);
if (form.ShowDialog(this) == DialogResult.OK)
editor.EditValue = form.EditingValue;
}
}
|
VB |
Private Sub ButtonEdit1_ButtonPressed(ByVal sender As Object, _
ByVal e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) _
Handles ButtonEdit1.ButtonPressed
Dim Editor As ButtonEdit = CType(sender, ButtonEdit)
Dim buttonIndex As Integer = Editor.Properties.Buttons.IndexOf(e.Button)
If buttonIndex = 0 Then
Dim form As Form2 = New Form2(Editor.EditValue)
If form.ShowDialog(Me) = DialogResult.OK Then
Editor.EditValue = form.EditingValue
End If
End If
End Sub
|