I have a very simple xaml file where I am passing the same Paragraph and Run elements to both a RichTextBox and a FlowDocumentScrollViewer. The both look radically different - which is not what I was expecting.
I understand that you can style either the FlowDocument or the containers so they look the same but I was expecting them both to inherit the same 'default' settings.
Here is my code:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80" />
<RowDefinition Height="80" />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<RichTextBox Grid.Row="0">
<FlowDocument>
<Paragraph>
<Run>Here is some text</Run>
<LineBreak />
<Run>Here is some more text</Run>
</Paragraph>
</FlowDocument>
</RichTextBox>
<TextBlock Grid.Row="1" Padding="6,0,0,0">
<Run>Here is some text</Run>
<LineBreak />
<Run>Here is some more text</Run>
</TextBlock>
<FlowDocumentScrollViewer Grid.Row="2" IsHitTestVisible="True" VerticalScrollBarVisibility="Hidden">
<FlowDocument>
<Paragraph>
<Run>Here is some text</Run>
<LineBreak />
<Run>Here is some more text</Run>
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</Grid>
My Question
Is there some way of ensuring that both RichTextBox and the FlowDocumentScrollViewer display the FlowDocument in the same way? Ideally so you can't tell the difference between them - without having to 'hard code' margins, fonts etc into one or the other.
You'll notice in my example above my Textblock requires some Margin to get it to display the same as the RichTextBlock, but I really want to avoid having to do anything like this as there will no doubt be a situation where some font or culture setting breaks this all horribly.