'Declaration Public Event Action As EventHandler(Of Viewer.ActionEventArgs)
public event EventHandler<Viewer.ActionEventArgs> Action
Event Data
The event handler receives an argument of type Viewer.ActionEventArgs containing data related to this event. The following Viewer.ActionEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Action | Specifies the action that should be performed in response to this event. |
PageNumber | Specifies the page number in current layout tree that should be navigated to. |
Remarks
This event is raised in response to user interactions with report items that have associated actions, such as hyperlinks or drill-through links. The Viewer.ActionEventArgs provides details about the action to be performed, including any necessary parameters or identifiers. Handlers for this event can perform custom processing, redirect actions, or cancel the default action execution by setting the System.ComponentModel.CancelEventArgs.Cancel property of the event arguments.
Example
// Assuming 'viewer' is your Viewer control instance viewer.Action += Viewer_CustomActionTriggered;; // Handler for the CustomActionTriggered event private void Viewer_CustomActionTriggered(object sender, ActionEventArgs e) { var viewer = (Viewer)sender; // Check if there's a specific action defined if (e.Action != null) { // Handle the custom action HandleCustomAction(e.Action); } else if (e.PageNumber >= 0) { // Navigate to the specified page number if no specific action is defined viewer.CurrentPage = e.PageNumber; } } // Example method to handle a custom action private void HandleCustomAction(IAction action) { // Implement custom action handling logic here // This could involve checking the type of action and responding accordingly Debug.WriteLine($"Handling custom action: {action.GetType().Name}"); }
See Also