A newer version of this page is available. Switch to the current version.

HyperLinkEdit.OpenLink Event

Occurs before hyperlink execution.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v19.2.dll


Event Data

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

Property Description
EditValue Gets or sets the object representing the command to execute.
Handled Gets or sets whether default execution of the hyperlink command is required.


The OpenLink event is fired before hyperlink execution. The event lets you modify the command to execute, perform actions and to cancel default processing.

The editor's OpenLink event is equivalent to the RepositoryItemHyperLinkEdit.OpenLink event available via the HyperLinkEdit.Properties object, i.e. adding/removing an event handler for the current event actually affects the RepositoryItemHyperLinkEdit.OpenLink event.

Refer to the RepositoryItemHyperLinkEdit.OpenLink topic for more information.


Suppose that a hyperlink editor is used to display e-mails. When you activate the hyperlink, the default mail client should be opened for the specified address. The problem is that a hyperlink editor will run the mail client only if the command contains a "mailto:" prefix. So a command such as "support@devexpress.com" is not recognized by the editor by default.

Assuming that the hyperlink editor represents e-mails, we handle the HyperLinkEdit.OpenLink event and check whether the command contains the "mailto:" prefix. If not, we add it to the command. After the event handler is processed, the command will be executed by the editor (the OpenLinkEventArgs.Handled property of the event parameter is false by default) and this will open the mail client.

using DevExpress.XtraEditors.Controls;

this.hyperLinkEdit2.EditValue = "support@devexpress.com";
private void hyperLinkEdit2_OpenLink(object sender, OpenLinkEventArgs e) {
    const string mailPrefix = "mailto:";
    if(!e.EditValue.ToString().ToLower().StartsWith(mailPrefix)) {
        e.EditValue = mailPrefix + e.EditValue.ToString();
See Also