You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -81,7 +83,7 @@ You can also use the overloaded methods for inserting a hyperlink:
81
83
82
84
* public void __InsertHyperlink__(HyperlinkInfo hyperlinkInfo, StyleDefinition hyperlinkStyle) - create a hyperlink from the currently selected part of the document and change the style of the text to the style passed as second argument.
83
85
84
-
Removing a hyperlink (and keeping the part of the document that the hyperlink spanned) can be done by positioning the caret in the hyperlink and invoking.
86
+
Removing a hyperlink (and keeping the part of the document that the hyperlink spanned) can be done by positioning the caret in the hyperlink and invoking:
By default, hyperlinks take a fixed string as a tool tip. The default format is:
211
213
@@ -214,20 +216,67 @@ By default, hyperlinks take a fixed string as a tool tip. The default format is:
214
216
215
217
You have control over it using the __HyperlinkToolTipFormatString__ of **RadRichTextEditor**, which will set the format for all hyperlinks in the document.
216
218
217
-
__HyperlinkClicked__
219
+
### HyperlinkClicked event
220
+
221
+
When a hyperlink is clicked, the __HyperlinkClicked__ event of __RadRichTextEditor__ is fired. The sender of the event is the document element, which you have clicked, e.g. a **Span**, an **Image**, **InlineUIContainer**, etc. The __HyperlinkClickedEventArgs__ provide the possibility either to cancel or replace the navigation action. This is helpful when you need to validate the clicked hyperlink and prevent it from navigating to an unsecure address or from starting a local process.
222
+
223
+
With the 2024 Q4 release, the default navigation behavior of the hyperlinks is to automatically open only valid and trusted addresses. The hyperlink navigation can be cancelled by either setting the __Handled__ property of the HyperlinkClickedEventArgs to _true_ or __IsTrustedUrl__ to _false_.
224
+
225
+
Here is an example of using the HyperlinkClicked event prompting that the clicked hyperlink might be unsafe and allows to cancel the navigation process upon receiving the end user confirmation:
e.Handled=true; MessageBoxResultResult=System.Windows.MessageBox.Show("You are about to open an executable file. Do you want to proceed", "Possible unsafe link", MessageBoxButton.YesNo, MessageBoxImage.Question);
DimResultAsMessageBoxResult=System.Windows.MessageBox.Show("You are about to open an executable file. Do you want to proceed","Possible unsafe link",MessageBoxButton.YesNo,MessageBoxImage.Question)
257
+
IfResult=MessageBoxResult.YesThen
258
+
Process.Start(NewProcessStartInfo()With{
259
+
.FileName=link,
260
+
.UseShellExecute=True
261
+
})
262
+
EndIf
263
+
EndIf
264
+
EndSub
218
265
219
-
When you click on a hyperlink, the __HyperlinkClicked__ event of __RadRichTextEditor__ is fired. The sender of the event is the document element, which you have clicked, e.g. a **Span**, an **Image**, **InlineUIContainer**, etc. The event args on the other hand, provide the possibility to mark the event as handled and prevent the default action. Custom logic can also be implemented depending on the __HyperlinkTarget__ and __URL__, which are also visible as properties of the event args.
220
266
221
-

267
+
````
268
+
269
+
{{endregion}}
270
+
222
271
223
-
## HyperlinkNavigationMode
272
+
###HyperlinkNavigationMode
224
273
225
-
This property allows you to control what action should trigger the opening of a hyperlink. The possible options are:
274
+
The __HyperlinkNavigationMode__ allows you to control what action should trigger the opening of a hyperlink. The possible options are:
226
275
227
276
***CtrlClick**: Triggers the hyperlink when users hold the Ctrl key and click on the hyperlink.
228
277
***Click**: Triggers the hyperlink when users click on the hyperlink.
229
278
230
-
#### Change the default hyperlink navigation mode
279
+
Below is demonstrated how to change the default hyperlink navigation mode:
0 commit comments