Task: Make InlineUIContainer text content inline with external text
The standard behavior of InlineUIContainer content is when the bottom edge is embedded in the outer text.
You can move the contents of an InlineUIContainer using a RenderTransform, but a Y value must be selected for each type and font size - this is not an ideal way.
<RichTextBox>
<FlowDocument>
<Paragraph>
LLL
<InlineUIContainer>
<Border Background="LightGoldenrodYellow">
<TextBlock Text="LLL"/>
</Border>
</InlineUIContainer>
LLL
</Paragraph>
<Paragraph>
LLL
<InlineUIContainer>
<Border Background="LightGoldenrodYellow">
<Border.RenderTransform>
<TranslateTransform Y="5" />
</Border.RenderTransform>
<TextBlock Text="LLL"/>
</Border>
</InlineUIContainer>
LLL
</Paragraph>
</FlowDocument>
</RichTextBox>

How to align text in InlineUIContainer content with external text in RichTextBox regardless of font type and size?
source
share