title: DatagGridViewColumn.DataPropertyName to an array element?
body: <p>I'm using a DataGridView binding its datasource to a List, and specifying the properties for each column.</p>
  
  <p>An example would be:</p>
  
  <pre><code> DataGridViewTextBoxColumn colConcept = new DataGridViewTextBoxColumn();
              DataGridViewCell cell4 = new DataGridViewTextBoxCell();
              colConcept.CellTemplate = cell4;
              colConcept.Name = "concept";
              colConcept.HeaderText = "Concept";
              colConcept.DataPropertyName = "Concept";
              colConcept.Width = 200;
              this.dataGridViewBills.Columns.Add(colConcept);
  </code></pre>
  
  <p>{... assign other colums...}</p>
  
  <p>And finally</p>
  
  <pre><code> this.dataGridViewBills.DataSource=billslist; //billslist is List&lt;Bill&gt;
  </code></pre>
  
  <p>Obviously Class Bill has a Property called Concept, as well as one Property for each column.</p>
  
  <p>Well, now my problem, is that Bill should have and Array/List/whateverdynamicsizecontainer of strings called Years. </p>
  
  <p>Let's assume that every Bill will have the same Years.Count, but this only known at runtime.Thus, I can't specify properties like Bill.FirstYear to obtain Bill.Years[0], Bill.SecondYear to obtain Bills.Years[1]... etc... and bind it to each column.</p>
  
  <p>The idea, is that now I want to have a grid with dynamic number of colums (known at runtime), and each column filled with a string from the Bill.Years List. I can make a loop to add columns to the grid at runtime depending of Bill.Years.Count, but is possible to bind them to each of the strings that the Bill.Years List contains???</p>
  
  <p>I'm not sure if I'm clear enough.</p>
  
  <p>The result ideally would be something like this,  for 2 bills on the list, and 3 years for each bill:</p>
  
  <pre>
  --------------------------------------GRID HEADER-------------------------------
  NAME      CONCEPT         YEAR1              YEAR2                YEAR3   
  --------------------------------------GRID VALUES-------------------------------
  Bill1     Bill1.Concept   Bill1.Years[0]     Bill1.Years[1]       Bill1.Years[2]
  Bill2     Bill2.Concept   Bill2.Years[0]     Bill2.Years[1]       Bill2.Years[2]
  
  
  </pre>
  
  <p>I can always forget the datasource, and write  each cell manually, as the MSFlexGrid used to like, but if possible, I would like to use the binding capabilities of the DataGridView.</p>
  
  <p>Any ideas? Thanks a lot.</p>