windowsforms-devexpress-dot-xtramap-dot-mapcontrol-2c44823f.md
Occurs when a hyperlink on a map is clicked.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
public event HyperlinkClickEventHandler HyperlinkClick
Public Event HyperlinkClick As HyperlinkClickEventHandler
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. |
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
}
}
}
Imports DevExpress.XtraMap
Imports System.Windows.Forms
Namespace MapApp
Public Partial Class Form1
Inherits DevExpress.XtraEditors.XtraForm
Public Sub New()
Dim map As MapControl = New MapControl()
' ...
Dim v_layer = New VectorItemsLayer()
Dim itemStorage = New MapItemStorage()
Dim customElement = New MapCustomElement() With {
.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)
AddHandler map.HyperlinkClick, AddressOf Map_HyperlinkClick
End Sub
Private Sub Map_HyperlinkClick(sender As Object, e As DevExpress.Utils.HyperlinkClickEventArgs)
' do something
End Sub
End Class
End Namespace
See Also