UWP - TextBlock underline text 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="StackPanel1" 
        Margin="50" 
        Orientation="Vertical"
        Background="AliceBlue"
        Padding="50"
        >
        <Border Background="PaleGreen">
            <TextBlock
                x:Name="TextBlock1"
                Margin="50"
                TextWrapping="Wrap"
                FontSize="25"
                >
                <Underline>
                    <Run>
                        This is a underlined text.
                    </Run>
                </Underline>
                <Run>
                    Non underlined text.
                </Run>
            </TextBlock>
        </Border>
        <Border Background="Peru">
            <TextBlock
                x:Name="TextBlock2"
                Margin="50"
                FontSize="30"
                TextWrapping="Wrap"
                FontFamily="MV Boli"
                Text="Second TextBlock. "
                />
        </Border>
    </StackPanel>
</Page>
MainPage.xaml.cs

using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Documents;


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

            // Initialize a new Underline instance
            Underline underline = new Underline();

            // Initialize a new Run instance
            Run run = new Run();

            // Set the text for run
            run.Text = "This is programmatically underlined text.";

            // Add the Run to Underline
            underline.Inlines.Add(run);

            // Finally, show the underlined text on second text block
            TextBlock2.Inlines.Add(underline);
        }
    }
}