public RichTextBlock CalculateHeight(RichTextBlock currentTextBlock, double width) { var tb = new RichTextBlock { FontSize = currentTextBlock.FontSize }; if (_text == null) { return(tb); } // Create run and set text Run run = new Run(); run.Text = _text; // Create paragraph Paragraph paragraph = new Paragraph(); // Add run to the paragraph paragraph.Inlines.Add(run); tb.Blocks.Add(paragraph); tb.MinWidth = width; tb.MaxWidth = width; tb.Width = width; tb.MaxHeight = Double.PositiveInfinity; tb.TextWrapping = TextWrapping.WrapWholeWords; tb.Measure(new Size(width, Double.PositiveInfinity)); tb.Arrange(new Rect(0, 0, width, tb.DesiredSize.Height)); tb.UpdateLayout(); return(tb); }