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="Azure"
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 empty Dictionary instance
Dictionary<String, string> colors = new Dictionary<string, string>();
// Put some key value pairs into the dictionary
colors.Add("SILVER", "#C0C0C0");
colors.Add("RED", "#FF0000");
colors.Add("GREEN", "#008000");
colors.Add("AQUA", "#00FFFF");
colors.Add("PURPLE", "#800080");
colors.Add("LIME", "#00FF00");
// Finally, Specify the ComboBox items source
ComboBox1.ItemsSource = colors;
// Specify the ComboBox items text and value
ComboBox1.SelectedValuePath = "Value";
ComboBox1.DisplayMemberPath = "Key";
}
private void ComboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// Get the ComboBox instance
ComboBox comboBox = sender as ComboBox;
// Get the ComboBox selected item value and display on TextBlock
TextBlock1.Text = "You selected:\n";
TextBlock1.Text += "Value : " + comboBox.SelectedValue.ToString();
}
}
}


- UWP - CalendarDatePicker example
- UWP - TimePicker example
- UWP - ComboBox default selected item
- UWP - ComboBox DisplayMemberPath and SelectedValuePath
- UWP - ComboBox item style example
- 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