title: How to bind a ComboBox to generic dictionary via ObjectDataProvider
body: <p>I want to fill a ComboBox with key/value data in code behind, I have this:</p>
  
  <p><strong>XAML:</strong></p>
  
  <pre><code>&lt;Window x:Class="TestCombo234.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:TestCombo234"
      Title="Window1" Height="300" Width="300"&gt;
      &lt;Window.Resources&gt;
          &lt;ObjectDataProvider x:Key="Choices" ObjectType="{x:Type local:CollectionData}" MethodName="GetChoices"/&gt;
      &lt;/Window.Resources&gt;
      &lt;StackPanel HorizontalAlignment="Left"&gt;
          &lt;ComboBox ItemsSource="{Binding Source={StaticResource Choices}}"/&gt;
      &lt;/StackPanel&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p><strong>Code Behind:</strong></p>
  
  <pre><code>using System.Windows;
  using System.Collections.Generic;
  
  namespace TestCombo234
  {
      public partial class Window1 : Window
      {
          public Window1()
          {
              InitializeComponent();
          }
      }
  
      public static class CollectionData
      {
          public static Dictionary&lt;int, string&gt; GetChoices()
          {
              Dictionary&lt;int, string&gt; choices = new Dictionary&lt;int, string&gt;();
              choices.Add(1, "monthly");
              choices.Add(2, "quarterly");
              choices.Add(3, "biannually");
              choices.Add(4, "yearly");
              return choices;
          }
      }
  }
  </code></pre>
  
  <p><strong>What do I have to change so that the key is the int and the value is the string?</strong></p>