问题
Is there a way to insert white space of given width to FlowDocument
as Inline
? So that I can 'indent' some other Inline
s 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.
回答1:
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>
回答2:
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.
来源:https://stackoverflow.com/questions/5796778/insert-white-space-of-arbitrary-width-to-flowdocument