Adding Custom Options

PrintTaskOptionDetails supports exposing custom options that make sense only to your app. For example, the Calendar app could support printing modes of Day, Work week, Week, or Month, independently of the current display on the screen.

The following code adds two custom options. One can be set to freeform text, whereas the other must be set to a value from a predefined list:

void OnPrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs args) {   // This is invoked when the Print pane opens   PrintTask task = args.Request.CreatePrintTask("Document Title",     async (taskArgs) =>     {       ...     });   PrintTaskOptionDetails details =     PrintTaskOptionDetails.GetFromPrintTaskOptions(task.Options); ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.