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 a开发者_Python百科ppears (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?
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.
精彩评论