Hyperlink Class

A hyperlink in a document.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v21.2.dll


public class Hyperlink :


A hyperlink can navigate to a bookmark in the document or to an external resource.

  • The BookmarkName property specifies the name of the bookmark to which the hyperlink navigates.

  • The Url property specifies the external resource’s URL.

If the BookmarkName property is specified, the Url property is not in effect.

Call a CreateAsync method to add a hyperlink to a sub-document.

<DxRichEdit @bind-Selection="@selection" @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Selection selection;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
        try {
        @* ... *@
            // Insert a hyperlink to a URL
            var position = richEdit.Selection.CaretPosition;
            await documentAPI.Hyperlinks.CreateAsync(position, "Go to Google", "https://www.google.com/");
            @* ... *@
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");

Call the GetAsync(Int32) method to find a hyperlink with the specified index in the document.

// Gets URLs of all hyperlinks in the document
List<string> hyperlinkUrls = new List<string>();
var hyperlinks = await documentAPI.Hyperlinks.GetAllAsync();
for (int i = 0; i < hyperlinks.Count; i++) {
    var hLink = await documentAPI.Hyperlinks.GetAsync(i);
    if (hLink.Url != "")

Call the RemoveAsync(Int32) method to remove a hyperlink.

// Remove the first hyperlink
await documentAPI.Hyperlinks.RemoveAsync(0);


See Also