title: Add collection or array to wpf resource dictionary
body: <p>I've search high and low and can't find an answer to this.  I have two questions</p>
  
  <ol>
  <li>How do you create an array or collection in XAML.  I've got an array I want to stick in there and bind to a combo box.  My first idea was to put an ItemsControl in a resource dictionary, but the ItemsSource of a combo box expects IEnumerable so that didn't work.</li>
  </ol>
  
  <p>Here's what I've tried in my resource dictionary and neither works</p>
  
  <pre><code>&lt;ItemsControl x:Key="stateList"&gt;
      &lt;sys:String&gt;AL&lt;/sys:String&gt;
      &lt;sys:String&gt;CA&lt;/sys:String&gt;
      &lt;sys:String&gt;CN&lt;/sys:String&gt;
  &lt;/ItemsControl&gt;
  &lt;ItemsControl x:Key="stateList2"&gt;
      &lt;ComboBoxItem&gt;AL&lt;/ComboBoxItem&gt;
      &lt;ComboBoxItem&gt;CA&lt;/ComboBoxItem&gt;
      &lt;ComboBoxItem&gt;CN&lt;/ComboBoxItem&gt;
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>and here's how I bind to it</p>
  
  <pre><code>&lt;ComboBox SelectedValue="{Binding Path=State}" ItemsSource="{Binding Source={StaticResource stateList2}}"  &gt;
  
                      &lt;/ComboBox&gt;
  </code></pre>
  
  <p>EDIT: UPDATED</p>
  
  <p>I got this first part to work this way</p>
  
  <pre><code> &lt;col:ArrayList x:Key="stateList3"&gt;
      &lt;sys:String&gt;AL&lt;/sys:String&gt;
      &lt;sys:String&gt;CA&lt;/sys:String&gt;
      &lt;sys:String&gt;CN&lt;/sys:String&gt;
  &lt;/col:ArrayList&gt;
  </code></pre>
  
  <p>However, I'd rather not use an array list, I'd like to use a generic list so if anyone knows how please let me know.</p>
  
  <p>EDIT UPDATE: I guess XAML has very limited support for generics so maybe an array list is the best I can do for now, but I would still like help on the second question if anyone has an anser</p>
  
  <p>2nd.  I've tried referencing a merged resource dictionary in my XAML and had problems because under Window.resources I had more than just the dictionary so it required me to add x:Key.  Once I add the key, the system can no longer find the items in my resource dictionary.  I had to move the merged dictionary to Grid.Resources instead.  Ideally I'd like to reference the merged dictionary in the app.xaml but I have the same problem</p>
  
  <p>Here's some sample code.  This first part required an x:key to compile because I have converter and it complained that every item must have a key if there is more than one</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
      &lt;win:BooleanToVisibilityConverter x:Key="VisibilityConverter" /&gt;
      &lt;ResourceDictionary&gt;
          &lt;ResourceDictionary.MergedDictionaries&gt;
              &lt;ResourceDictionary Source="/ResourcesD.xaml" /&gt;
          &lt;/ResourceDictionary.MergedDictionaries&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/UserControl.Resources&gt;
  </code></pre>
  
  <p>I had to change it to this</p>
  
  <pre><code>&lt;UI:BaseStep.Resources&gt;
      &lt;win:BooleanToVisibilityConverter x:Key="VisibilityConverter" /&gt;             
  &lt;/UI:BaseStep.Resources&gt;
  &lt;Grid&gt;
      &lt;Grid.Resources&gt;
          &lt;ResourceDictionary&gt;
              &lt;ResourceDictionary.MergedDictionaries&gt;
                  &lt;ResourceDictionary Source="/ResourcesD.xaml" /&gt;
              &lt;/ResourceDictionary.MergedDictionaries&gt;
          &lt;/ResourceDictionary&gt;
      &lt;/Grid.Resources&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>Thank you</p>