Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Hyperlink.BookmarkName Property

Specifies the name of a bookmark to which the hyperlink navigates.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

#Declaration

C#
public string BookmarkName { get; }

#Property Value

Type Description
String

A bookmark name.

#Remarks

A hyperlink can navigate to a bookmark in the document or to an external resource. Use the BookmarkName property to specify the name of the bookmark to which the hyperlink navigates.

Razor
<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit { get; set; }
    @* ... *@
    /* 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 {
        @* ... *@
            // Create a bookmark
            var bookmarkTextSpan = await richEdit.DocumentAPI.AddTextAsync("Chapter 1");
            var bookmarkChapter1 = await richEdit.DocumentAPI.Bookmarks.CreateAsync(bookmarkTextSpan.Interval, "chapter1Bookmark");
            @* ... *@
            // Create a hyperlink to the bookmark
            var hlChapter1Span = await richEdit.DocumentAPI.AddTextAsync("To learn more, see the Chapter 1");
            await richEdit.DocumentAPI.Hyperlinks.CreateAsync(hlChapter1Span.Interval, "", bookmarkChapter1.Name, "Go to Chapter 1");
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

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

See Also