MainPage.xaml
<UserControl x:Class="Subsequence.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock Text="string 1:" Margin="10,15,0,0"/>
        <TextBox x:Name="string1" Height="24" Width="150" Margin="70,10,0,0" 
                 VerticalAlignment="Top" HorizontalAlignment="Left"></TextBox>
        <TextBlock Text="string 2:" Margin="10,45,0,0"></TextBlock>
        <TextBox x:Name="string2" Height="24" Width="150" Margin="70,40,0,0"
                 VerticalAlignment="Top" HorizontalAlignment="Left"></TextBox>
        <Button x:Name="button1" Content="Click for result" Height="24" Width="120"
                Margin="85,80,20,20" Click="button1_Click"
                VerticalAlignment="Top" HorizontalAlignment="Left"></Button>
        <TextBlock x:Name="resultstring" Text="The result is:" Height="24" Margin="10,120,0,0"
                   VerticalAlignment="Top"></TextBlock>
    </Grid>
</UserControl>
MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Subsequence
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            int l1, l2;
            int i, j, index;
            Arrow[] arrows;
            char[] result;

            l1 = string1.Text.Length + 1;
            l2 = string2.Text.Length + 1;

            arrows = new Arrow[l1 * l2];

            for (i = 0; i < l1; i++)
            {
                arrows[i].value = 0;
            }

            for (j = 0; j < l2; j++)
            {
                arrows[j * l1].value = 0;
            }

            // table creation

            for (j = 1; j < l2; j++)
            {
                for (i = 1; i < l1; i++)
                {
                    if (string1.Text[i - 1] == string2.Text[j - 1])
                    {
                        arrows[j * l1 + i].i = -1;
                        arrows[j * l1 + i].j = -1;
                        arrows[j * l1 + i].value = arrows[(j - 1) * l1 + (i - 1)].value + 1;
                    }
                    else
                    {
                        if (arrows[(j - 1) * l1 + i].value >= arrows[j * l1 + (i - 1)].value)
                        {
                            arrows[j * l1 + i].value = arrows[(j - 1) * l1 + i].value;
                            arrows[j * l1 + i].i = 0;
                            arrows[j * l1 + i].j = -1;
                        }
                        else
                        {
                            arrows[j * l1 + i].value = arrows[j * l1 + (i - 1)].value;
                            arrows[j * l1 + i].i = -1;
                            arrows[j * l1 + i].j = 0;
                        }
                    }
                }
            }

            i = l1 - 1;
            j = l2 - 1;
            result = new char[arrows[j * l1 + i].value + 1];

            index = j * l1 + i;

            while (arrows[index].value > 0)
            {
                index = j * l1 + i;
                if (arrows[index].i == -1 && arrows[index].j == -1)
                {
                    result[arrows[index].value - 1] = string1.Text[i - 1];
                }
                i += arrows[index].i;
                j += arrows[index].j;
            }

            string s = new String(result);
            resultstring.Text = "The result is: " + s;
        }

        struct Arrow
        {
            public int value, i, j;
        }
    }
}