This code shows how to create a ComboBox and add items to it in WPF and XAML.
<Canvas Name="LayoutRoot">
<ComboBox Name="ComboBox1" Width="270" Height="30" >
<ComboBoxItem Name="cbi1">C# Corner</ComboBoxItem>
<ComboBoxItem Name="cbi2">VB.NET Heaven</ComboBoxItem>
<ComboBoxItem Name="cbi3">MSDN</ComboBoxItem>
</ComboBox>
</Canvas>
The following code creates same ComboBox dynamically using WPF classes.
private void CreateWPFComboBox()
{
ComboBox cbox = new ComboBox();
cbox.Width = 280;
cbox.Height = 30;
cbox.Background = Brushes.LightBlue;
ComboBoxItem cboxitem = new ComboBoxItem();
cboxitem.Content = "C# Corner";
cbox.Items.Add(cboxitem);
ComboBoxItem cboxitem2 = new ComboBoxItem();
cboxitem2.Content = "VB.NET Heaven";
cbox.Items.Add(cboxitem2);
ComboBoxItem cboxitem3 = new ComboBoxItem();
cboxitem3.Content = "MSDN";
cbox.Items.Add(cboxitem3);
LayoutRoot.Children.Add(cbox);
}