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="YellowGreen"
Padding="100"
>
<ComboBox
x:Name="ComboBox1"
Header="Select A Color"
SelectionChanged="ComboBox1_SelectionChanged"
>
</ComboBox>
<TextBlock
x:Name="TextBlock1"
FontFamily="Consolas"
FontSize="25"
Foreground="Navy"
Margin="50,5,5,5"
/>
</StackPanel>
</Page>
MainPage.xaml.cs
using Windows.UI.Xaml.Controls;
using System.Collections.Generic;
using System;
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("Red");
colors.Add("Green");
colors.Add("Blue");
colors.Add("Yellow");
colors.Add("Black");
colors.Add("Olive");
colors.Add("Pink");
colors.Add("White");
colors.Add("Magenta");
// Finally, Specify the ComboBox items source
ComboBox1.ItemsSource = colors;
}
private void ComboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// Get the ComboBox instance
ComboBox comboBox = sender as ComboBox;
// Get the ComboBox selected item text and display on TextBlock
TextBlock1.Text = "You selected:\n";
TextBlock1.Text += comboBox.SelectedValue.ToString();
}
}
}


- UWP - CalendarDatePicker example
- UWP - DatePicker example
- UWP - PasswordBox example
- UWP - ComboBox default selected item
- UWP - ComboBox DisplayMemberPath and SelectedValuePath
- UWP - ComboBox item style example
- UWP - Get ComboBox selected value
- UWP - Canvas example
- UWP - ScrollViewer scroll to bottom
- UWP - ScrollViewer example
- UWP - Viewbox stretch example
- UWP - Viewbox example
- UWP - How to resize SymbolIcon
- UWP - Create Button programmatically
- UWP - RepeatButton example