PrintingController.PrintingSettingsLoaded Event
Occurs when the PrintingController.PrintAction is executed.
Namespace: DevExpress.ExpressApp.Win.SystemModule
Assembly: DevExpress.ExpressApp.Win.v19.2.dll
Declaration
Event Data
The PrintingSettingsLoaded event's data class is DevExpress.ExpressApp.Win.SystemModule.PrintableComponentLinkEventArgs.
Remarks
The PrintingSettingsLoaded event is raised as the result of invoking the PrintingController.LoadPrintingSettings method. You can handle this event in a custom View Controller to customize the PrintableComponentLink, which represents a printing link to the printable control. In the handler, you can access the PrintableComponentLink object in the following manner:
using DevExpress.ExpressApp.Win.SystemModule;
// ...
public class ConfigurePrintingSettingsViewController : ViewController {
private PrintingController printingService;
protected override void OnActivated() {
base.OnActivated();
printingService = Frame.GetController<PrintingController>();
if (printingService != null)
printingService.PrintingSettingsLoaded += printingService_PrintingSettingsLoaded;
}
private void printingService_PrintingSettingsLoaded(
object sender, PrintableComponentLinkEventArgs e) {
e.PrintableComponentLink.PaperKind = System.Drawing.Printing.PaperKind.A4;
e.PrintableComponentLink.Landscape = true;
}
protected override void OnDeactivated() {
if (printingService != null)
printingService.PrintingSettingsLoaded -= printingService_PrintingSettingsLoaded;
base.OnDeactivating();
}
}
The PrintableComponentLink object provides access to the PrintingSystem object using the PrintingSystem property. Refer to the How to: Customize Export Options of the Printing System, to see an example on how to access the Printing System in the PrintingSettingsLoaded event handler.
Note
The PrintingSettingsLoaded event is not raised when GridControl is used with a CollectionSource object in Server mode (see CollectionSourceBase.DataAccessMode), or when the PrintingController.CustomForceGridControlMethods event is handled and its Force parameter is set to true. In this case, you can customize the grid print preview options using the GridOptionsPrint object.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PrintingSettingsLoaded event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.