add enter to text in texblock c# code example
Example 1: wpf textblock line break code behind
TextBlock tb = new TextBlock();
tb.Inlines.Add(new Run("Hello"));
tb.Inlines.Add(new LineBreak());
tb.Inlines.Add(new Run("Would you please just work?"));
Example 2: wpf textblock line break code behind
TextBlock tb = new TextBlock();
tb.Text = "Hello" + Environment.NewLine + "Would you please just work?";