The event handler receives an argument of type HyperLinkClickedEventArgs containing data related to this event. The following HyperLinkClickedEventArgs properties provide information specific to this event.
Property | Description |
---|
Action | Determines which action is executed. |
Data | Contains the user data or the link for the action to be executed. |
Protocol | Contains the used protocol of the user data or the link for the action to be executed. |
ReturnValue | Determines whether List & Label should perform its own standard execution or whether no further processing should be executed by List & Label because your own implementation/action has already been executed.
Value
|
Meaning
|
0
|
Perform standard List & Label handling.
|
1
|
Do not have any further standard handling executed by List & Label.
|
Default
|
0
|
|
TooltipText | Determines the tooltip text to be displayed when the mouse is moved over the object in the preview. |
The following example shows how to register the event for List & Label and contains an exemplary implementation that reacts to your own protocol myProtocol and displays special tooltip text accordingly and implements the click actions.
// Register the event for custom actions hovering a object with link property for the preview.
LL.HandleHyperlinkAction += LL_HandleHyperlinkAction;
// Event implementation for handling custom actions within the preview
private void LL_HandleHyperlinkAction(object sender, HyperLinkClickedEventArgs e)
{
// Collect input data for further use
string function = string.Empty, value = string.Empty;
if (!string.IsNullOrEmpty(e.Data))
{
function = e.Data.Split('=')[0];
value = e.Data.Split('=')[1];
}
switch (e.Action)
{
// Define the tooltip when hovering over an object
// within the preview
case LlHyperlinkAction.QueryTooltip:
{
// check if this is "my" business at all
if (e.Protocol == "myProtocol")
{
switch (function)
{
case "searchCustomer":
{
e.TooltipText = $"Searches the selected \n customer" +
$" '{value}' within the application.";
}
break;
case "searchOrder":
{
e.TooltipText = $"Searches the selected \n order" +
$" with ID '{value}' within the application.";
}
break;
}
// 1 = indicates handled by your own application-code
// 0 = use default handling from List & Label
e.ReturnValue = 1;
}
}
break;
// This is queried whenever the object with the link property is hovered
case LlHyperlinkAction.RightButtonAllowed:
{
// 1 = not allowed
// 2 = allowed
e.ReturnValue = 1;
}
break;
// Left mouse button was clicked
case LlHyperlinkAction.LeftClicked:
{
// 1 = indicates handled by your own application-code
// 0 = use default handling from List & Label
int actionResult = 0;
if (e.Protocol == "myProtocol")
{
MessageBox.Show($"Object with custom Link property " +
$"was clicked with left mouse button and contains " +
$"this information:\n\n " +
$"protocol: {e.Protocol}\n " +
$"function: {function}\n " +
$"value: {value}");
actionResult = 1;
}
e.ReturnValue = actionResult;
}
break;
// Right mouse button was clicked
case LlHyperlinkAction.RightClicked:
{
// do anything with the right-click here, if allowed
// by action LlHyperlinkAction.RightButtonAllowed
}
break;
}
}
Platforms: Windows 10 (Version 21H2 - 23H2), Windows 11 (21H2 - 22H2), Windows Server 2016 - 2022
.NET: .NET Framework 4.8, .NET 6, .NET 8, .NET 9