In this topic, you will learn how to add items to the C1ComboBox control in C# and Visual Basic code. This method is useful when you’re creating a static combo box with just a few items.
Complete the following steps:
To disable AutoComplete, complete the following:
1. Open the MainPage.xaml.cs page.
2. Import the following namespace into your project:
Imports C1.WPF
•C#
Using C1.WPF;
3. Enter Code view and add the following code beneath the InitializeComponent() method:
C1ComboBox1.Items.Add(New C1ComboBoxItem() With {.Content = "C1ComboBoxItem1"})
C1ComboBox1.Items.Add(New C1ComboBoxItem() With {.Content = "C1ComboBoxItem2"})
C1ComboBox1.Items.Add(New C1ComboBoxItem() With {.Content = "C1ComboBoxItem3"})
C1ComboBox1.Items.Add(New C1ComboBoxItem() With {.Content = "C1ComboBoxItem4"})
•C#
c1ComboBox1.Items.Add(new C1ComboBoxItem() { Content = "C1ComboBoxItem1" });
c1ComboBox1.Items.Add(new C1ComboBoxItem() { Content = "C1ComboBoxItem2" });
c1ComboBox1.Items.Add(new C1ComboBoxItem() { Content = "C1ComboBoxItem3" });
c1ComboBox1.Items.Add(new C1ComboBoxItem() { Content = "C1ComboBoxItem4" });
4. Run the program.
This Topic Illustrates the Following:
With the project running, click the drop-down arrow and observe that four items appear in the drop-down list. The result resembles the following image: