Back to Devexpress

XRControl.Action Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-76584aff.md

latest4.0 KB
Original Source

XRControl.Action Property

Specifies the action assigned to the control.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[DefaultValue(null)]
[SRCategory(ReportStringId.CatBehavior)]
public virtual XRAction Action { get; set; }
vb
<SRCategory(ReportStringId.CatBehavior)>
<DefaultValue(Nothing)>
Public Overridable Property Action As XRAction

Property Value

TypeDefaultDescription
XRActionnull

An action assigned to the control.

|

Remarks

You can use the Action property of report controls (XRControl descendants, such as XRTableCell and XRLabel) to create drill-through reports. The Action property provides access to NavigateToReportAction. NavigateToReportAction allows you to specify the detail report instance or URL to define a master-detail relationship and obtain a collection of detail report parameter bindings.

The following code snippet shows how to define master-detail relationships between Category and Product reports within a single project:

csharp
using DevExpress.XtraReports.Interactivity;
using DevExpress.XtraReports.UI;

namespace Drill_through_example {
    public partial class XtraReportCategories : DevExpress.XtraReports.UI.XtraReport {
        public XtraReportCategories(){
            InitializeComponent();

            // Create a NavigateToReportAction instance and specify its settings
            NavigateToReportAction cellAction = new NavigateToReportAction();
            cellAction.ReportSource = new XtraReportProducts();

            // Assign the NavigateToReportAction object to the control’s Action property
            tableCell6.Action = cellAction;

        }
    }
}
vb
Imports DevExpress.XtraReports.Interactivity
Imports DevExpress.XtraReports.UI

Namespace Drill_through_example
    Partial Public Class XtraReportCategories
        Inherits DevExpress.XtraReports.UI.XtraReport

        Public Sub New()
            InitializeComponent()

            ' Create a NavigateToReportAction instance and specify its settings
            Dim cellAction As New NavigateToReportAction()
            cellAction.ReportSource = New XtraReportProducts()

            ' Assign the NavigateToReportAction object to the control’s Action property
            tableCell6.Action = cellAction

        End Sub
    End Class
End Namespace

When you switch to the preview, you can now click on the Category value in the table and navigate to the detail report that contains Product values.

A Breadcrumb control automatically appears below the Document Viewer toolbar and allows you to navigate back to the original report.

Review the following tutorial for more information on how to implement drill-through functionality in the UI: Create Drill-Through Reports.

See Also

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace