Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For the sake of completeness I'd mention that the approved answer doesn't suit if you've got some objects that doesn't inherit <a href="http://msdn.microsoft.com/en-us/library/system.windows.freezable.aspx" rel="nofollow">Freezable</a> class. The standard ObservableCollection only allows updates from the dispatcher thread, so you need a thread-safe analog. There are two solutions of WPF guru <a href="http://deanchalk.com" rel="nofollow">Dean Chalk</a> what solve the problem:</p> <ol> <li>Create a thread-safe observable collection. It's an old school solution that just works. To get the source code check a <a href="http://deanchalk.com/2010/02/01/thread-safe-dispatcher-safe-observable-collection-for-wpf/" rel="nofollow">short article in his blog</a>.</li> <li>Use <a href="http://msdn.microsoft.com/en-us/data/gg577609.aspx" rel="nofollow">Reactive Extensions</a> library. See <a href="http://deanchalk.com/2013/05/16/multi-threading-observablecollection-reactive-extensions/" rel="nofollow">this article</a> for an example. It's a bit bulky for one task, but meanwhile it brings a bunch of modern tools which come in handy.</li> </ol> <p><strong>UPDATE (31 July 2015):</strong></p> <p>Links to Dean Chalk's blog are dead, so here are alternatives:</p> <ul> <li>Thread-safe observable collection: <a href="http://web.archive.org/web/20101105144104/http:/www.deanchalk.me.uk/post/Thread-Safe-Dispatcher-Safe-Observable-Collection-for-WPF.aspx" rel="nofollow">article</a>, <a href="https://github.com/tamirdresher/WinRTThreadSafeObservableCollection/blob/master/ThreadSafeObservableCollection.cs" rel="nofollow">source code</a>.</li> <li>Multi-threading, ObservableCollection, Reactive Extensions: <a href="http://web.archive.org/web/20130730053625/http://deanchalk.com/2013/05/16/multi-threading-observablecollection-reactive-extensions" rel="nofollow">article</a>.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload