[]
Provides data for the Action event, encapsulating details about an action that should be performed.
public class Viewer.ActionEventArgs : CancelEventArgs
// 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}");
}
Name | Description |
---|---|
ActionEventArgs() | Initializes a new instance of the Viewer.ActionEventArgs class. This default constructor initializes the instance without specifying an action or page number. |
ActionEventArgs(IAction) | Initializes a new instance of the Viewer.ActionEventArgs class with the specified action. This constructor is used when an action is defined without a specific page navigation. |
ActionEventArgs(IAction, int) | Initializes a new instance of the Viewer.ActionEventArgs class with the specified action and page number. This constructor is used when the action involves navigating to a specific page. |
Name | Description |
---|---|
Action | Gets the action that should be performed in response to this event. |
PageNumber | Gets the page number in the current layout tree that should be navigated to. This property is relevant when the action involves navigating to a specific page. |