Is there a way I can wire up hyperlinks to open when the user clicks on them with the middle mouse button?
2 Answers, 1 is accepted
0
Dimitar
Telerik team
answered on 17 Dec 2019, 09:29 AM
Hi Joshua,
You can use the following approach to achieve this:
privatevoidRadRichTextBox_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
{
var position = e.GetPosition(radRichTextBox);
var sp = this.radRichTextBox.Document.GetLayoutBoxByPosition(this.radRichTextBox.ActiveEditorPresenter.GetDocumentPointFromViewPoint(position).ToPointF()) as SpanLayoutBox;
var inline = sp.AssociatedInline as Inline;
var method = typeof(HyperlinkUIProviderBase).GetMethod("OpenHyperlink", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
method.Invoke(null, newobject[] { inline });
}
}
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.