private void BtnClearLog_Click(object sender, RoutedEventArgs e) { TxtLog.SelectAll(); TxtLog.Selection.Text = string.Empty; TxtLog.Document.PageWidth = 5000; var newParagraph = new Paragraph { Margin = new Thickness(0, 0, 0, 0) }; TxtLog.Document.Blocks.Add(newParagraph); }