Skip to main content

MapControl.HyperlinkClick Event

Occurs when a hyperlink on a map is clicked.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v25.1.dll

NuGet Package: DevExpress.Win.Map

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

In the following code snippet, the HyperlinkClick event occurs when a user clicks a MapCustomElement while simultaneously holding down Ctrl:

using DevExpress.XtraMap;
using System.Windows.Forms;

namespace MapApp {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {

            MapControl map = new MapControl();
            //...

            var v_layer = new VectorItemsLayer();
            var itemStorage = new MapItemStorage();
            var customElement = new MapCustomElement() {
                Location = new GeoPoint(50, 50),
                AllowHtmlText = true,
                Text = "<a href='https://devexpress.com'>Click me</a>"
            };
            itemStorage.Items.Add(customElement);
            v_layer.Data = itemStorage;
            map.Layers.Add(v_layer);

            map.HyperlinkClick += Map_HyperlinkClick;
        }

        private void Map_HyperlinkClick(object sender, DevExpress.Utils.HyperlinkClickEventArgs e) {
            // Do something
        }
    }
}
See Also