title: Pseudo-Infinite Grid
body: <p>I've got a bit of a design issue here.</p>
  
  <p>I've got a view:</p>
  
  <pre><code>&lt;ItemsControl x:Name="CellVMs"&gt;
      &lt;ItemsControl.ItemsPanel&gt;
        &lt;ItemsPanelTemplate&gt;
              &lt;Grid /&gt;
           &lt;/ItemsPanelTemplate&gt;
      &lt;/ItemsControl.ItemsPanel&gt;
      &lt;ItemsControl.ItemContainerStyle&gt;
        &lt;Style&gt;
          &lt;Setter Property="Grid.Row"
                  Value="{Binding Position.Y}" /&gt;
          &lt;Setter Property="Grid.Column"
                  Value="{Binding Position.X}" /&gt;
        &lt;/Style&gt;
      &lt;/ItemsControl.ItemContainerStyle&gt;
    &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>which is bound to a collection of viewmodels, that have a position property which the style there uses to position it on the ItemPanelTemplate. (Only one viewmodel per cell, and the grid cells are fixed size)</p>
  
  <p>1) I would like that Grid to be pseudo-infinite, ie as EditorVMs get added and subtracted, the Grid should dynamically add and delete Row\Col Definitions, and there should always be enough Grid, and there should always be enough to fill the parent view.</p>
  
  <p>2) In my containing viewmodel, I import an IGridEditor implementation instance which has a Grid property. How can I bind the ItemsPanelTemplateGrid to the IEditor.Grid? </p>
  
  <p>Right now, I add the CellVM's to a collection in the IGridEditor's methods, then when the containing vm imports the instance, sets the containing vm's CellVM collection to the instances collection, and the item control binds to that using Caliburn.Micro's conventions.</p>
  
  <p>I'm using Caliburn.Micro\MEF btw.</p>
  
  <p>Can anyone help me figure this out?</p>
  
  <p>Edit:</p>
  
  <p>Been trying to understand this, but I'm coming up empty.</p>
  
  <p>Only thing I can find is</p>
  
  <pre><code>&lt;ItemsControl.ItemsPanel&gt;
           &lt;ItemsPanelTemplate&gt;
              &lt;Grid x:Name="EditorGrid"/&gt;
           &lt;/ItemsPanelTemplate&gt;
      &lt;/ItemsControl.ItemsPanel&gt;
  </code></pre>
  
  <p>and in my viemodel:</p>
  
  <pre><code>[Import("EditorGrid", typeof(Grid))]
  public Grid EditorGrid { get; set; }
  </code></pre>
  
  <p>and a corresponding Export in class that has the methods to add things to the grid/</p>