Creating FlowDocument on BackgroundWorker thread
问题 I have the need to generate dynamically generate a FlowDocument from a large set of data. Because the process takes several minutes, I'd like to perform the operation on a background thread rather than have the UI hang. However, I can't generate the FlowDocument on a non-UI thread otherwise attempts to insert rectangles and images cause run-time errors complaining that it's not STA thread. There are a couple of threads on StackOverflow which seem to involve the same problem I'm having: