Hi Experts,
i have a small problem with the DocumentViewer control. I am Rendering my document in a different thread, so far everything works fine, after that i want to display the fixeddocumentsequence in the viewer control. Here is where my problem starts i tried nearly everything but i cant set the document to the viewer, i always get a threading exception, that says that the document belongs to a differnt thread. I know what this exceptoin means, but i do not know why it's raised.
Here is the code where I render the document and then try to display it in the viewer:
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() => { Build(); System.Windows.Documents.FixedDocumentSequence se = Document.FixedDocumentSequence; viewer.Dispatcher.BeginInvoke((Action)(() => { viewer.Document = se; })); })); t.SetApartmentState(System.Threading.ApartmentState.STA); t.IsBackground = true; t.Start();
Can anyone help me with this "hopefully" easy Problem?
Kind Regards
Manu