Microsoft.Toolkit.Win32 icon indicating copy to clipboard operation
Microsoft.Toolkit.Win32 copied to clipboard

It's not possible to print through Xamlslands in WPF

Open atiyka opened this issue 5 years ago • 4 comments

Describe the bug

In a WPF application (targeting .NET core 3.1) I'm using XamlHosts to display windows 10 design UI elements. I'd like to print from my app - display the Win10 print preview.

I checked the printing in UWP Samples, I could start and it's working. But as I moved the code to my custom UWP component (which is displayed in the WPF application), the print preview doesn't display. As I call the await PrintManager.ShowPrintUIAsync();, it throws the following exception:

Error: System.ArgumentException: Value does not fall within the expected range.

None of the following callbacks are fired: Paginate, GetPreviewPage, AddPages, PrintTaskRequested. So, the error happens before any of these are called.

I checked every setting and configuration in the sample app (where it's working) and everything is the same as in my app. So, I'm wondering if the problem is with the XamlIslands?

Steps to Reproduce

I created a sample project, where it reproduces the issue. You can find it here. The exception raises in PrintHelper.cs:116.

Expected behavior

It would be great if I could show to the user the win10 designed print preview UI.

Environment

NuGet Package(s): 
Microsoft.Toolkit.Wpf.UI.XamlHost - version 6.1.2

Project .NET Version:
- [x] .NET Core 3.1

Windows 10 Build Number:
- [x] version 2004, os build 9041.746

App min and target version:
- [x] May 2019 Update (18362)

Device form factor:
- [x] Desktop

Visual Studio 
- [x] 2019 Community (version: 16.7.7)

atiyka avatar Feb 04 '21 10:02 atiyka

Hello atiyka, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Feb 04 '21 10:02 ghost

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

ghost avatar Feb 19 '21 11:02 ghost

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

ghost avatar Mar 06 '21 14:03 ghost

FYI @marb2000

michael-hawker avatar Mar 18 '21 22:03 michael-hawker