Dispatcher cross thread

I have a WPF Grid and a list of values. The list of values have a row and column property and the content value. There are between 200 and 14,000 values to be displayed in a formatted grid.

I have added rows and columns to the grid then added text blocks to the grid in the correct row/column positions.

This works great till I have around 8,000 values then it slows down. To remedy I put it out to a thread to perform the layout, problem is, my TextBlocks are created on one thread then when I try to add them to the Children member of the Grid using the UI dispatcher the text block is on a different thread.

So the question is, can I switch the thread affinity of the Textblocks to the UI thread after I've created them?

Thanks Owen

Answers


Are you going to show all the 8000 values at once or are you having some scrollbars?

Adding 8000 controls to a view would be considered a bad design.

Why don't you go for a ListView and template it according your design if the values have the same template? So that you can bind it to an ObservableCollection which could be filled up using the List of Values you have. The fill could be made asynchronous using Dispatcher's BeginInvoke method


Need Your Help

NSString method to percent escape '&' for URL

cocoa-touch encoding nsstring

Which NSString encoding method will percent escape the ampersand (&) character correctly into %26?

Detect ui language in htc sense on android

android locale htcsense

I want to give the users of my app content in the same language as their ui interface. So if someone who has HTC Sense has their ui interface in Norwegian, they should get Norwegian content. However,