title: Binding WPF ComboBox to Dictionary<String,ObservableCollection<String>>
body: <p>In my ViewModel, I have a Dictionary of observable string collections, declared as below.</p>
  
  <pre><code>public Dictionary&lt;string, ObservableCollection&lt;string&gt;&gt; NamePartsDict { get; set; }
  </code></pre>
  
  <p>I would like to bind the Dictionary to ComboBoxes in my user interface in such a way that each ComboBox can 'select' which collection to bind to.</p>
  
  <p>So in my XAML, I would like to use:</p>
  
  <pre><code>&lt;ComboBox x:Name="comboBox" IsEditable="True"
      ItemsSource="{Binding CurrentLibrary.NamePartsDict[Year]}" Margin="80,0,0.871,0"&gt;&lt;/ComboBox&gt;
  </code></pre>
  
  <p>which I would expect to bind to the Collection that is indexed by the Key "Year", and populate the ComboBox with the strings stored in the collection.</p>
  
  <p>However, this XAML results in an empty ComboBox.</p>
  
  <p>I have verified that the Dictionary itself can be bound. The below XAML populates the ComboBox with the string representations of each Key, Value pair.</p>
  
  <pre><code>&lt;ComboBox x:Name="comboBox" IsEditable="True"
      ItemsSource="{Binding CurrentLibrary.NamePartsDict}" Margin="80,0,0.871,0"&gt;&lt;/ComboBox&gt;
  </code></pre>
  
  <p>Is something in my binding path wrong when obtaining the value from the dictionary? Or am I trying to do something that isn't possible (in which case I'll have to find another way!)?</p>
  
  <p>Any help much appreciated!</p>
  
  <p>Tim</p>