I've written a nice priority queue class,
class ConcurrentPriorityQueue<T>
: IProducerConsumerCollection<KeyValuePair<int,T>>, INotifyCollectionChanged
where T : INotifyPropertyChanged
which I now want to wrap in a in a BlockingCollection
,
Queue = new ConcurrentPriorityQueue<DownloadItem>(10);
Buffer = new BlockingCollection<KeyValuePair<int, DownloadItem>>(Queue, 1000)
{
new KeyValuePair<int, DownloadItem>(0, new DownloadItem{Url = "stackoverflow.com"})
};
So that it can add a maximum capacity, and hopefully some thread-safety. Now, however, I seem to have lost the observable functionality!
How can I hook a DataGrid up to this collection so it still receive the collection changed notifications?