When I have added a comboBox to the WPF window, how do I add items to the comboBox? Int the XAML code for the design or in NameOfWindow.xaml.cs file?
Use this
string[] str = new string[] {"Foo", "Bar"}; myComboBox.ItemsSource = str; myComboBox.SelectedIndex = 0;
OR
foreach (string s in str) myComboBox.Items.Add(s); myComboBox.SelectedIndex = 0;