var printItem = new MenuItem { Header = "Print..." };printItem.Click += (sender, e) => {
var reportSection = new EmbeddedVisualReportSection(this); var report = new Report(); report.Sections.Add(reportSection); report.Export(OutputFormat.XPS, @"c:\test.xps"); // Exports fine the entire grid. report.Print(); //throws CrossThread exception
};gridMenu.Items.Add(printItem);
What could be the reason?
More information:
App is multithreaded.
report.Print(false, false) is printing. But printing without PrintDialog does not make sense for us.
Can you look into this issue please?
This link might help:
http://stackoverflow.com/questions/2972513/printdialog-in-multithreaded-wpf-window-thrown-targetinvocationexception
I would appreciate any feedback on that issue.
Thanks
Could we please get some feedback on that issue? Thanks
This item now is pending since several weeks. As a "paying" customer I would think it's reasonable to expect some feedback on that issue.
Infragistics support: would you mind providing some info on that matter or let us know if the scenario provided above would not be clear enough?
Thanks in advance
Hello Dierk,
I tested it on a small sample and the report.Print() does not produce an error. Can you provide a sample that demonstrates the issue?
Thank you,
Sam
Sam,
You just need to run into scenario where report is created on different thread than app main thread.
PrintDialog is causing the issue since.
Everything works fine with single threaded application.
Dierk,
The Report object is not thread safe. You would need to be on the same UI thread.
We are bouncing back and forward. I have created different thread for different problem:
http://community.infragistics.com/forums/p/51097/267692.aspx#267692
I should say Microsoft PrintDialog not ReportDialog, in the link you provided.
Sorry, which "ReportDialog" are you reffering to?
Somehow my response is not showing in this thread. I am not sure if you received it somehow.
Earlier today I have commented that this issue appeared to me Microsoft related bug with ReportDialog as Andrew pointed out, and our Report class is using WPF ReportDialog.
As I stated PrintingDialog issue has been resolved for now, but I described the different issue about how grid is printed or exported to XPS file. It is not related to printing since exporting to xps does the same thing. Please see couple posts above.