Skip to main content

Hyperlink Class

A hyperlink in a document.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit


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 canceled. */
        try {
        @* ... *@
            // Insert a hyperlink to a URL
            var position = richEdit.Selection.CaretPosition;
            await documentAPI.Hyperlinks.CreateAsync(position, "Go to Google", "");
            @* ... *@
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");

Call the GetAsync(Int32, CancellationToken) 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, CancellationToken) method to remove a hyperlink.

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

Users can select one of the following commands to invoke this dialog:

  • The InsertHyperlink ribbon command
  • The Edit Hyperlink… context menu command
  • The Hyperlink… context menu command

The Hyperlink dialog allows users to edit existing and create new links to web pages, bookmarks, or e-mail addresses.

Hyperlink Dialog


See Also