How can I display a BusyIndicator during printing in Silverlight 4?

一个人想着一个人 提交于 2019-12-11 12:31:35

问题


I want to display a BusyIndicator during printing. If I turn on my BusyIndicator in the BeginPrint event and turn it off in the EndPrint event, it never appears (BusyIndicator.DisplayAfter is set to 0). I assume this is because the actual printing is taking place on a different thread. So if I turn it on before actually calling PrintDocument.Print, the BusyIndicator does show, but of course that's not what I want (the BusyIndicator appears when the user is just selecting his/her printer before actual printing takes place).

I tried creating a property of my user control implemented as a DependencyProperty that BusyIndicator.IsBusy is bound to and setting that property's value true/false in the BeginPrint and EndPrint events. I tested the binding to this property by setting it true outside of printing, and it works. But still, when I set that property in the print events, nothing.

I can't do any of the work in the BeginPrint or EndPrint events in a BackgroundWorker either.

How the heck can I turn on my BusyIndicator?


回答1:


Hack from Russia ))) I've done it this way: https://cid-99a78e3907425ccf.office.live.com/self.aspx/Sources/PrintDataGrid.RAR . Here I'am printing my DataGrid with showing busyindicator.



来源:https://stackoverflow.com/questions/4563831/how-can-i-display-a-busyindicator-during-printing-in-silverlight-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!