Skip to main content

AlertControl.AlertClick Event

Fires when the text of alert windows is clicked.

Namespace: DevExpress.XtraBars.Alerter

Assembly: DevExpress.XtraBars.v24.2.dll

Declaration

[DXCategory("Events")]
public event AlertClickEventHandler AlertClick

Event Data

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

Property Description
ActivateOwner Gets or sets whether the owner (a form) of the current alert window is activated after executing your AlertControl.AlertClick event handler.
AlertForm Gets the currently processed alert window.
Info Gets an object that contains information displayed in the currently processed alert window.

Remarks

You can handle this event to respond to clicking the text in alert windows. For instance, you can move focus to another window, focus another control, etc.

If the AlertControl.AllowHotTrack option is disabled, the AlertClick event will not be raised when clicking an alert window’s text.

Example

The following example shows how you can respond to an end-user clicking an alert window’s text. To respond to these actions, the AlertControl.AlertClick event is handled.

In the example, it’s assumed that alert windows are used to show notifications to end-users when a new e-mail arrives. When a new alert window is created, a custom MailData object is associated with the window. This object contains information on the e-mail received, and it is accessed and processed while handling the AlertControl.AlertClick event.

private void ShowAlertWindow() {
    Form owner;
    string caption, text, hotTrackedText;
    Image image;
    MailData mailData;
    // Initialize the owner, caption, text, hotTrackedText, image and mailData
    // ...
    // Show an alert window with these parameters
    alertControl1.Show(owner, caption, text, hotTrackedText, image, mailData);
}

private void alertControl1_AlertClick(object sender, AlertClickEventArgs e) {
    // Get and process the data associated with the current alert window.
    MailData mailData = e.Info.Tag as MailData;
    ShowEmail(mailData);
}

private void ShowEmail(MailData mailData) {
    //...
}

public class MailData {
    //...
}
See Also