Skip to main content

ContextButtonBase.HyperlinkClick Event

Fires when a hyperlink in the button caption is clicked.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v23.2.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public event HyperlinkClickEventHandler HyperlinkClick

Event Data

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

Property Description
Link Get or sets the URL of the clicked hyperlink.
MouseArgs Gets or sets mouse coordinates calculated from the toolbar’s upper left corner.
Text Gets or sets the hyperlink alt text. Note that modifying this text does not change the item caption.

Remarks

If the HTML formatting feature is enabled (see ContextButtonBase.AllowHtmlText), you can display a hyperlink in the button caption (see ContextButtonBase.Caption) using the href tag. The ContextButtonBase.HyperLinkColor property allows you to specify the color of the hyperlink text.

If the caption contains a hyperlink, handle the HyperlinkClick event to respond to a click on the hyperlink. The Link property of event arguments returns the hyperlink being clicked. The Text property returns the hyperlink text. The code snippet below shows how the HyperlinkClick event can be handled (it is assumed that the context button is displayed in the PictureEdit control).

using DevExpress.Utils;

ContextButton link = new ContextButton();
link.Caption = "<href=www.devexpress.com>Our web site</href>";
link.AllowHtmlText = DefaultBoolean.True;
link.HyperlinkClick += link_HyperlinkClick;
link.HyperLinkColor = Color.Fuchsia;
link.AlignmentOptions.Panel = ContextItemPanel.Bottom;
link.AlignmentOptions.Position = ContextItemPosition.Far;
pictureEdit1.Properties.ContextButtons.Add(link);

void link_HyperlinkClick(object sender, HyperlinkClickEventArgs e) {
    Process.Start("IEXPLORE.EXE", e.Link);
}

After the HyperlinkClick event is fired, the ContextItem.Click event fires.

See Also