PrintingController.PrintingSettingsLoaded Event

Occurs when the PrintingController.PrintAction is executed.

Namespace: DevExpress.ExpressApp.Win.SystemModule

Assembly: DevExpress.ExpressApp.Win.v18.2.dll

Declaration

public event EventHandler<PrintableComponentLinkEventArgs> PrintingSettingsLoaded
Public Event PrintingSettingsLoaded As EventHandler(Of PrintableComponentLinkEventArgs)

The PrintingSettingsLoaded event handler receives an argument of the DevExpress.ExpressApp.Win.SystemModule.PrintableComponentLinkEventArgs type.

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.

See Also