MainPage.xaml
<Page
x:Class="UniversalAppTutorials.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UniversalAppTutorials"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel
x:Name="stack_panel1"
Orientation="Horizontal"
Background="GhostWhite"
Padding="100"
>
<ComboBox
x:Name="ComboBox1"
Header="Select A Color"
>
</ComboBox>
</StackPanel>
</Page>
MainPage.xaml.cs
using Windows.UI.Xaml.Controls;
using System.Collections.Generic;
namespace UniversalAppTutorials
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
// Initialize a new list of colors
List<string> colors = new List<string>();
// Put some colors to the list
colors.Add("ALICEBLUE");
colors.Add("SEASHELL");
colors.Add("FLORALWHITE");
colors.Add("FORESTGREEN");
colors.Add("MEDIUMSEAGREEN");
colors.Add("LAWNGREEN");
colors.Add("PAPAYAWHIP");
colors.Add("LEMONCHIFFON");
// Finally, Specify the ComboBox items source
ComboBox1.ItemsSource = colors;
/*
SelectedIndex
Gets or sets the index of the selected item.
(Inherited from Selector)
*/
// Set the default selected item of ComboBox
ComboBox1.SelectedIndex = 2;
// Alternate way to specify a default selected item
//ComboBox1.SelectedItem = "LAWNGREEN";
}
}
}


- UWP - CalendarDatePicker example
- UWP - TimePicker example
- UWP - ComboBox DisplayMemberPath and SelectedValuePath
- UWP - ComboBox item style example
- UWP - Get ComboBox selected value
- UWP - ComboBox ItemsSource example
- UWP - Canvas example
- UWP - ScrollViewer scroll to bottom
- UWP - ScrollViewer example
- UWP - Understanding RelativePanel elements position
- UWP - How to add a Hyperlink to a TextBlock
- UWP - How to make TextBlock text selectable
- UWP - TextBox ScrollBar example
- UWP - How to change TextBox style
- UWP - Select TextBox all text when get focus