Search code examples
wpflayoutflowdocumentsymmetry

WPF FlowDocument Symmetric Layout


How can a symmetric layout be generated using one FlowDocument?

My code is:

<Grid Name="grid1">
<FlowDocumentScrollViewer Name="name1" Margin="6,0,17,0">
<FlowDocument>
 <Paragraph>
 <Figure HorizontalAnchor="PageLeft" VerticalAnchor="PageTop" Width="0.5content">
   <BlockUIContainer>
      <Button >HelloTwo</Button>
   </BlockUIContainer>
 </Figure>
 <Figure HorizontalAnchor="PageRight" VerticalAnchor="PageTop" Width="0.5content">
   <BlockUIContainer>
      <Button >HelloTwo</Button>
   </BlockUIContainer>
 </Figure>
 </Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</Grid>    

I want them to be aligned side-by-side with each one's content in the same position. How can I achieve this layout?


Solution

  • You should use FlowDocumentReader or FlowDocumentPageViewer. Using FlowDocumentScrollViewer, Figure is treated as different anchored block, and can't be paired side by side.