title: WPF binding a property to a list of objects
body: <p>I need some help to resolve a simple XAML binding problem I have. </p>
  
  <p>I use MVVM pattern with 2 classes. Card and Board. I already created a model with a Card. The Card class is composed bu two properties only. </p>
  
  <ol>
   <li>The value of my card.</li>
   <li>The state of my card (downside or upside). The board contain a list of cards.</li>
  </ol>
  
  <pre><code>public class Card
  {
      public int Value { get; private set; }
      public bool Upside { get; set; }
  
      public Card(int value)
      {
          this.Value = value;
      }
  }
  
  class Board
  {
      private List&lt;Card&gt; _cardList = new List&lt;Card&gt;();
      public List&lt;Card&gt; CardList
      {
          get
          {
              return _cardList;
          }
          set
          {
              if (_cardList == value)
              {
                  return;
              }
              _cardList = value;
              raisePropertyChanged("CardList");
          }
      }
  
      public void Initialize()
      { 
         // Initialization of the card list
      }
  
      public void FlipCard()
      {
         // The rules and actions of my game
      }
  }
  </code></pre>
  
  <p>After that I added all the <code>INotifyPropertyChanged</code> stuff on my card and board properties. I don't show you the code to stay as clear as possible.</p>
  
  <p>On my <code>ViewModel</code> I only expose this:</p>
  
  <pre><code>public Board GameBoard { get; set; }
  </code></pre>
  
  <p>Of course I have a lot of other methods, property and command but nothing about card. The rule of my game and my cards are all in my Board class. My <code>ViewModel</code> only expose classes specific to my XAML design.</p>
  
  <p>In my XAML file I have something like this. A card is a simple rectangle. I just need to bind the value of my card with the Fill property with the correct converter. The think is I only expose my Board so I need to write something like</p>
  
  <pre><code>Fill="{Binding **GameBoard.CardList[0]** 
  </code></pre>
  
  <p>I don't generate my rectangles at runtime. Right now I have 4 card on my board then I wrote 4 time the Rectangle code and hardcoded 4 time the name ending by 01, 02, 03, 04. I just show you the 01 here:</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;me:CardFillConverter x:Key="CardConverter"/&gt;
  &lt;/Window.Resources&gt;
  
  &lt;Rectangle x:Name="Card01" Fill="{Binding ??? Converter={StaticResource CardConverter}}" ... /&gt;
  </code></pre>
  
  <p>What is the correct binding?</p>