The Design
<Pagex:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ComboBox x:Name="combo1" HorizontalAlignment="Left" Margin="128,130,0,0" VerticalAlignment="Top" Width="272" SelectionChanged="combo1_SelectionChanged"/>
<TextBlock HorizontalAlignment="Left" Margin="115,57,0,0" TextWrapping="Wrap" Text="Select Your Items" FontSize="20" VerticalAlignment="Top" Height="35" Width="285"/>
<TextBlock x:Name="Label2" HorizontalAlignment="Left" Margin="115,203,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="29" Width="178"/>
</Grid>
</Page>
// Code behind code
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace App1
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
combo1.Items.Add("Button Control");
combo1.Items.Add("Label Control");
combo1.Items.Add("Media control");
}
private void combo1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Label2.Text = combo1.SelectedItem.ToString ();
}
}
}