65.9K
CodeProject is changing. Read more.
Home

ObservableDictionary!

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.95/5 (7 votes)

May 22, 2010

CPOL

1 min read

viewsIcon

47327

In WPF/Silverlight, you might want to bind to a dictionary. Here's a couple of websites I found.

I was writing some code today, and decided it would be real nice if I could use an ObservableDictionary to allow the possible binding of items to a WPF/Silverlight control. Of course, I was dismayed to find that Microsoft (once again) failed to anticipate the needs of (quite possibly) the laziest programmer ever to stop around in Visual Studio - there was no such collection in .Net. Lookout google, here I come. I was pleased my search was a relatively short one, and in the interest of saving you the time of conducting an identical search, I present you with my results - a sort of one-stop shopping experience, if you will. The first link provides the article discussing the basic ObservableDictionary: http://drwpf.com/blog/2007/09/16/can-i-bind-my-itemscontrol-to-a-dictionary/[^] And the second link allows you to add XML serialization: http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx[^] As with anything on the internet, I don't know how long these things will be around, so if I were you, I'd scoop the code as soon as humanly possible. I'[m working on an article that actually uses some of this code, so eventually, you'll be able to get it here as well (I'll get the original authors' permissions before I do that, though).