using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
public class MainClass : Window
{
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainClass());
}
public MainClass()
{
TextBlock text = new TextBlock();
text.FontSize = 32;
text.HorizontalAlignment = HorizontalAlignment.Center;
text.VerticalAlignment = VerticalAlignment.Center;
Content = text;
string strQuote = "this is a test";
string[] strWords = strQuote.Split();
foreach (string str in strWords)
{
Run run = new Run(str);
run.MouseDown += RunOnMouseDown;
text.Inlines.Add(run);
text.Inlines.Add(" ");
}
}
void RunOnMouseDown(object sender, MouseButtonEventArgs args)
{
Run run = sender as Run;
run.FontStyle = run.FontStyle == FontStyles.Italic ? FontStyles.Normal : FontStyles.Italic;
}
}