The task: Make the text content of the InlineUIContainer to be inline with the outer text
The standard behaviour of the InlineUIContainer content is when the bottom edge is inline with the outer text.
It is possible to shift the content of InlineUIContainer with RenderTransform, but the value of Y has to be chosen for each font type and size - not a perfect 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 the text in the InlineUIContainer content with the outer text in RichTextBox regardless of font type and size?
have you tried playing around with InlineUIContainer.BaselineAlignment
here are some examples for how to use it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With