UWP - DatePicker example

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="50"
        >
        <DatePicker
            x:Name="DatePicker1"
            DateChanged="DatePicker1_DateChanged"
            />
        <TextBlock
            x:Name="TextBlock1"
            Foreground="Navy"
            FontSize="22"
            TextWrapping="Wrap"
            Margin="10,75,10,10"
            />
    </StackPanel>
</Page>
MainPage.xaml.cs

using Windows.UI.Xaml.Controls;


namespace UniversalAppTutorials
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        private void DatePicker1_DateChanged(object sender, DatePickerValueChangedEventArgs e)
        {
            // Get the instance of DatePicker object
            DatePicker datePicker = sender as DatePicker;

            // When date changed
            TextBlock1.Text = "You selected:";

            // Get the DatePicker selected date
            TextBlock1.Text += "\n" + datePicker.Date;

            // Format the DatePicker selected date
            TextBlock1.Text += "\n" + datePicker.Date.ToString("dd-MM-yyyy");
            TextBlock1.Text += "\n" + datePicker.Date.ToString("dd/MMM/yyyy");
        }
    }
}