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?
I think comboBox1.Items.Add("X"); will add string to ComboBox, instead of ComboBoxItem.
comboBox1.Items.Add("X");
string
ComboBoxItem
The right solution is
ComboBoxItem item = new ComboBoxItem(); item.Content = "A"; comboBox1.Items.Add(item);