I’ve got a WPF application and I want to display some text with a little icon preceding it.
The text must wrap around.
I’ve got the following code working that does most of what I want (the code should work if you put it in a new WPF view):
<FlowDocumentScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> <FlowDocument IsHyphenationEnabled="False" IsOptimalParagraphEnabled="False" PagePadding="0" TextAlignment="Left" ScrollViewer.CanContentScroll="False" ScrollViewer.VerticalScrollBarVisibility="Hidden" SelectiveScrollingGrid.SelectiveScrollingOrientation="None" FontSize="20" LineStackingStrategy="MaxHeight" > <Paragraph KeepTogether="False" Padding="0"> <InlineUIContainer BaselineAlignment="Bottom"> <Image Height="16" Stretch="Uniform" Source="https://duck.co/static/img/logo_ddg_community.png" /> </InlineUIContainer> someverylongtextthatIwantwrappingaroundaggressively </Paragraph> </FlowDocument> </FlowDocumentScrollViewer>
When there’s enough width, it’s fine, I’ve got the icon followed by the text on the same line.
My issue is that when the width of the control gets smaller the control does not wrap around the text as I want it to.
Instead it puts the icon on a line of its own and the text on the next line.
Then as the control gets smaller it will wrap the text but still keep it on its own line.
Is there a way to force a more aggressive wrapping so that the text starts next to the icon and gets wrapped?