Search code examples
wpfflowdocument

WPF : spacing between two <span> without space character


i'm build some contents into flowdocument in programming way, not xaml.

i need a way to spacing between two spans, no use space character trick like following code:

Run spanTitle = new Run(paraTitle);
myTitle.Inlines.Add(spanTitle);

//" " + paraSubtitle to spacing spanTitle and spanSubTitle.
Run spanSubTitle = new Run(" " + paraSubtitle);
myTitle.Inlines.Add(spanSubTitle);

i can't found any property in Span class, like a Margin, Padding, etc.

how can i control a space of two spans in programming way?


Solution

  • The proper spacing between two Runs in a Span IS a space because it will fit the font.

    If you want a Margin or Padding, the two Runs should not be in the same Span.