title: WPF "Magic" in a PropertyGrid Control
body: <p>I started a hobby project to learn about WPF and in my reasearch i stumpled upon this WPF PropertyGrid <a href="http://www.codeplex.com/wpg" rel="nofollow noreferrer">http://www.codeplex.com/wpg</a></p>
  
  <p>I downloaded the source from <a href="http://wpg.codeplex.com/SourceControl/ListDownloadableCommits.aspx" rel="nofollow noreferrer">http://wpg.codeplex.com/SourceControl/ListDownloadableCommits.aspx</a>
  , And started browsing through it, looks cool, and works. But for the life of me, I can't figure out HOW it works. The following questions is what I'm left with at first glance.</p>
  
  <ul>
  <li>How does it know what properties an object have?</li>
  <li>How does it render the control to edit a Value?</li>
  <li>How does it decide what control to render? (i'm guessing meta data descriptions on the properties)</li>
  </ul>
  
  <p>I understand the DependancyProperties handles the dataexchange between new values.</p>
  
  <ul>
  <li>Where is the XAML or CodeBehind code that does all the magic?</li>
  </ul>
  
  <p>There is lots of XAML code in the Default.xaml file, but as far as I can tell it is only styles and the looks that are defined there.</p>