Answer the question
In order to leave comments, you need to log in
How to output data from the DispatcherTimer to the UI without waiting for it to complete?
Good day everyone! Please tell me how to overcome this problem:
The WPF application, on a timer, makes a request to the database, fills in the fields with the received data (all fields are inside the Border) and then the content of the border is printed. The problem is that the data is transferred to the UI later than printing takes place. THOSE. in the timer, the print is triggered, a blank sheet is printed, then the timer completes its work and the data appears in the UI.
Are there any solutions to "stop the timer", pass the data to the UI, print it and keep it running?
Where to dig?
Thank you!
Answer the question
In order to leave comments, you need to log in
UI is updated in a separate thread via dispatcher. In your case, he still did not have time to do his job.
those or do sleep-delay or something like this:
this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, (Action)delegate()
{
Todo: print
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question