title: Show a complex c# object which has properties and an inner collection in WPF
body: <p>I have a class like this:</p>
  
  <pre><code>public class NQWell : ObservableObject, ICloneable
  {
      public string Name { get; set; }
      public ObservableCollection&lt;KeyValuePair&lt;int, double&gt;&gt; ResultsObservableCollection { get; set; }
  }
  
  ObservableCollection&lt;NQWell&gt; wells { get; set; }
  </code></pre>
  
  <p>I want to show this object in WPF (ListView, Grid, something..)</p>
  
  <p>It should look like this:</p>
  
  <p>ColumnHeaders: </p>
  
  <pre><code>          Well   260    280  
  </code></pre>
  
  <p>Data:</p>
  
  <pre><code>           A1     0.2    0.3
             A2     0.1    0.4
             A3     0.6    0.5
  </code></pre>
  
  <p>The "Well" header comes from the name of the property, and the "260" and "280" are actually the keys from the observable collection.</p>
  
  <p>The problem is, how do I normalize the object?</p>
  
  <p>One possible solution that I thought would be to do it in itemscontrol for the first observable collection (wells) and show every property consequently in textblocks, and when it comes to the ObservableCollection> ResultsObservableCollection, I create another ItemsControl that walks that collection and shows it, and so on.</p>
  
  <p>Is there a better way? My thoughts were, I do a ListView with GridView, and then create anonymous types for the outer properties, and another anonymous type for the inner observable collection, which I merge in a new object at the end. But this is somehow too much work. Has somebody any better propsals?</p>