I have code (method/function) that retrieves data from a server and builds XAML. The code goes through a loop so the fetching of data is mixed with the code that creates the UI elements.
I want the main thread to stay responsive. I know I can't update the UI in "DoWork" without using a Dispatcher, but there is a lot of XAML code. Can I somehow wrap the whole method using Dispatacher and Delegate? What is the best approach to achieve this?
EDIT/UPDATE I ended up managing to separate the fetching of data from the XAML code. I just had to create a few more classes to temporarily hold the data. Thanks to all for your comments and suggestions.