Follow these simple steps to add a ComboBox control in your application UI:
- Replace the default Grid with a StackPanel to host UI controls horizontally stacked.
- Add the following XAML code, inside the StackPanel, to have a simple ComboBox control with some items in it:
<ComboBox Width="150" Height="26" Margin="10"> <ComboBoxItem Content="Item 1" /> <ComboBoxItem Content="Item 2" IsSelected="True" /> <ComboBoxItem Content="Item 3" /> <ComboBoxItem Content="Item 4" /> <ComboBoxItem Content="Item 5" /> </ComboBox>
- Add another ComboBox to have customized items, as shown in the following example code:
<ComboBox Width="150" Height="26" Margin="10"> <ComboBoxItem> <StackPanel Orientation="Horizontal"> <Rectangle Width=...