private void SetDifferencesText(CompareResult compareResult) { rtb.Document.Blocks.Clear(); Diff[] diffs = compareResult.GetDifferences(); if (diffs == null) { Paragraph paragraph = new Paragraph(new Run(FindResource("error_cannotGetDiff") as string)); rtb.Document.Blocks.Add(paragraph); return; } foreach (var diff in diffs) { switch (diff.operation) { case Operation.DELETE: { Paragraph paragraph = new Paragraph(); rtb.Document.Blocks.Add(paragraph); Run run = new Run(diff.text); paragraph.Inlines.Add(run); TextRange range = new TextRange(run.ContentStart, run.ContentEnd); range.ApplyPropertyValue(Inline.TextDecorationsProperty, TextDecorations.Strikethrough); } break; case Operation.INSERT: { Paragraph paragraph = new Paragraph(); rtb.Document.Blocks.Add(paragraph); Run run = new Run(diff.text); paragraph.Inlines.Add(run); TextRange range = new TextRange(run.ContentStart, run.ContentEnd); //range.ApplyPropertyValue(Inline.TextDecorationsProperty, TextDecorations.Strikethrough); } break; case Operation.EQUAL: break; } } }