Store floating element on one line in WPF FlowDocument

I have many hours googled, and although there are many examples of how to float WPF elements, it is difficult for me to get two simple elements that fit on the same line. Here is my code

<FlowDocument ColumnWidth="999999">
        <Section>
            <Paragraph>
                <Floater HorizontalAlignment="Left" Width="200">
                    <Paragraph>
                            <Run Text="Hello World Left"/>
                    </Paragraph>
                </Floater>
                <Floater HorizontalAlignment="Right" Width="200">
                    <Paragraph>
                            <Run Text="Hello World Right"/>
                    </Paragraph>
                </Floater>
            </Paragraph>
        </Section>
</FlowDocument>

I expect them to appear on the same line to the left and right of the page. However, the right side moves down the line:

enter image description here

How can I keep a floating point element on the right side at the same height as the left?

+4
source share
1 answer

I don’t know why this works (possibly with hanging or indentation), set the empty mileage as the first line of the line:

               <Paragraph >
                    <Run /> 
                    <Floater HorizontalAlignment="Left" Background="AliceBlue" 
                             BaselineAlignment="TextBottom" Width="200">
                        <Paragraph>
                            <Run Text="Hello World Left"/>
                        </Paragraph>
                    </Floater>
                    <Floater HorizontalAlignment="Right" Background="AntiqueWhite" 
                             BaselineAlignment="TextBottom" Width="200">
                        <Paragraph>
                            <Run Text="Hello World Right"/>
                        </Paragraph>
                    </Floater>
                </Paragraph>
+2
source

Source: https://habr.com/ru/post/1669628/


All Articles