[]
Sets the enabled or disabled state of a specified viewer command.
public void SetShortcutCommandState(ViewerCommand viewerCommand, bool state)
Type | Name | Description |
---|---|---|
ViewerCommand | viewerCommand | The ViewerCommand for which to set the enabled state. |
bool | state | If |
This method allows for the dynamic enabling or disabling of commands within the viewer, which can be useful for adjusting the available actions based on the current state or selection within the viewer. For example, disabling a 'Print' command when no document is loaded.
// Assuming 'viewer' is an instance of Viewer.
// Enabling the Print command.
viewer.SetShortcutCommandState(ViewerCommand.Print, true);
// Disabling the ZoomIn command.
viewer.SetShortcutCommandState(ViewerCommand.ZoomIn, false);
Type | Condition |
---|---|
ArgumentNullException | Thrown if the toolbar shortcut storage has not been initialized. |