Mega Code Archive

 
Categories / C# Tutorial / WPF
 

Assign TextBlock to window content

using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Documents;     class MainClass : Window     {         [STAThread]         public static void Main()         {             Application app = new Application();             app.Run(new MainClass());         }         public MainClass()         {             TextBlock txt = new TextBlock();             txt.FontSize = 32;              // 24 points             txt.Inlines.Add("This is some ");             Content = txt;         }     }