ContextButtonBase.HyperlinkClick Event

Fires when a hyperlink in the button caption is clicked.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v20.1.dll

Declaration

public event HyperlinkClickEventHandler HyperlinkClick
Public Event HyperlinkClick As HyperlinkClickEventHandler

Event Data

The HyperlinkClick event's data class is DevExpress.Utils.HyperlinkClickEventArgs.

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