Insert white space of arbitrary width to FlowDocum

2019-08-24 19:19发布

Is there a way to insert white space of given width to FlowDocument as Inline ? So that I can 'indent' some other Inlines as I want.

If it was possible to place some inline on some x-offset in the line that would also solve the problem.

NOTE: the purpose of this would be solving partial problem of the problem described in this question.

2条回答
地球回转人心会变
2楼-- · 2019-08-24 19:27

You could use the container classes, e.g.:

<RichTextBox>
    <FlowDocument>
        <Paragraph>
            <InlineUIContainer>
                <FrameworkElement Width="200"/>
            </InlineUIContainer>
            <Run x:Name="RunChan" Text="Indented Text"/>
        </Paragraph>
    </FlowDocument>
</RichTextBox>

I would not really recommend it though.


In a TextBlock:

<TextBlock>
    <InlineUIContainer>
        <FrameworkElement Width="200"/>
    </InlineUIContainer>
    <Run x:Name="RunChan" Text="Indented Text"/>
</TextBlock>
查看更多
疯言疯语
3楼-- · 2019-08-24 19:47

I'm not sure if this will solve your problem, but if you want to "indent" an Inline, perhaps you can insert a small Floater or Figure sized to what you need. Make sure the Floater is short so that it doesn't span more than a single line.

I'm looking for something more elegant than this myself, but this is working for me in the meanwhile.

查看更多
登录 后发表回答