Skip to main content

XRControl.BookmarkParent Property

Gets or sets the report control whose bookmark is the parent of the current bookmark.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

[DefaultValue(null)]
[SRCategory(ReportStringId.CatNavigation)]
public virtual XRControl BookmarkParent { get; set; }

Property Value

Type Default Description
XRControl null

An XRControl object representing the control whose bookmark is the parent of the current bookmark.

Remarks

Use this property to get or set the report control whose bookmark is used as the parent for the current control’s bookmark. The current control’s bookmark is specified by its XRControl.Bookmark property.

If the BookmarkParent property’s value is null (Nothing in Visual Basic), then the current control’s bookmark will be shown as connected to the root bookmark in the report’s document map. Note that the root bookmark’s text is specified by the XtraReport.Bookmark property of the report.

To get more information about using bookmarks in XtraReports see the Adding Bookmarks and a Document Map topic.

Not all descendants of the XRControl class use the BookmarkParent property. For example, the Band class descendants ignore the BookmarkParent property.

Example

This example demonstrates how to create a document map with bookmarks for each page in a report.

To implement a document map in your report, do the following.

  1. To create a table report, start with a report that is bound to the “Products” table of the sample Northwind database. To learn more about binding a report to a data source, see Providing Data to Reports.
  2. Set the report’s XtraReport.Bookmark property to “Table of Contents”.

    HowTo_AddBookmark5

  3. To create the report’s main content, drop the ProductName field from the Field List onto the report’s Detail band.

    How to - GroupData_3

  4. Insert a ReportHeaderBand. To do this, right-click anywhere in the report designer, and in the invoked context menu point to Insert Band, and then click ReportHeader.

    Shared_BandsAddReportHeader

    Drop an XRLabel control on the Report Header and set its XRControl.Bookmark and XRControl.Text properties to “Home”.

    HowTo_Bookmarks_0

  5. Insert a PageHeaderBand. To do this, right-click anywhere in the report designer, and in the context menu, point to Insert Band, and then click PageHeader.

    Shared_BandsAddPageHeader

    Drop an XRLabel control on the Page Header. Then, set its XRControl.Bookmark and XRControl.Text properties to “Page”, and the XRControl.BookmarkParent property to the Home label.

    HowTo_Bookmarks_1

    Next, handle the Page lable’s XRControl.PrintOnPage event as follows.

using System;
using DevExpress.XtraReports.UI;
// ...

private void xrLabel3_PrintOnPage(object sender, PrintOnPageEventArgs e) {
    // Obtain the current page number.
    string s = (e.PageIndex + 1).ToString();

    // Set the label's text and bookmark (this label is located on the PageHeader
    // band, so it will show a bookmark for every report page
    ((XRLabel)sender).Bookmark += s;
    ((XRLabel)sender).Text += s;
}
See Also