You can select an item at run-time by setting the SelectedIndex property to the position of the item. This topic assumes that your project contains one C1ComboBox control with at least two C1ComboBoxItem items.
In the Designer
Complete the following steps:
1. Select the C1ComboBox control.
2. In the Properties window, set the SelectedIndex property to "1" so that the second C1ComboBoxItem will be selected.
In XAML
To set a selected item, add SelectedIndex="0"
to the <c1:C1ComboBoxItem>
tag so that the markup resembles
the following:
<c1:C1ComboBoxItem Content="C1ComboBoxItem1" SelectedIndex="1">
In Code
Complete the following steps:
1. Open the MainPage.xaml.cs page.
2. Add the following code beneath the InitializeComponent() method:
C1ComboBoxItem1.SelectedIndex = 1
•C#
c1ComboBoxItem1.SelectedIndex = 1;
3. Run the program.
This Topic Illustrates the Following:
When the drop-down list is revealed at run time, the second item will be selected, such as in the following image.