title: WPF: how to bind ComboBox ItemsSource in code?
body: <p>I need to convert this following XAML into code-behind:</p>
  
  <pre><code>&lt;ComboBox SelectedItem="{Binding Level}" ItemsSource="{Binding Levels}" /&gt;
  </code></pre>
  
  <p>However, this code doesn't compile:</p>
  
  <pre><code>new ComboBox() { SelectedItem = new Binding("Level"), ItemsSource = new Binding("Levels") }
  </code></pre>
  
  <p>The error: "Cannot implicitly convert type 'System.Windows.Data.Binding' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?)". How do I cast?</p>