Search code examples
.netwpfflowdocumentparagraph

Flowdocument Run keep with next


In a Flowdocument how can I keep with next
When the text wraps I do not want a line break between these two runs

Run runMinus = new Run();
runMinus.Text = " -";
runMinus.Background = brushMinus;
pargraph.Inlines.Add(runMinus);
Run run = new Run();
run.Text = "sample";
run.Background = brushParen;
pargraph.Inlines.Add(run);

Solution

  • Got it working with zero width nbsp (non-breaking space)

    run.Text = " –\uFEFF";