I have a WPF usercontrol that I want to load with dynamic content in code using a FlowDocument: textblocks, bulleted lists, etc. Content is loaded as expected. And the box sizes looks fine in designer, but in runtime the FlowDocument insists on clipping the result and only show part of the width.
My assumption was that the Viewbox would fill the grid cell and the inner FlowDocument to fill up all available space.
I tried to set the PageWidth/PageHeigth of the FlowDocument in code but with no result.
Any help appreciated.
<Grid x:Name="grdDisplay">
<Grid.RowDefinitions>
<RowDefinition Height="22*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Viewbox x:Name="viewboxContent" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Top" StretchDirection="DownOnly">
<FlowDocumentScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden">
<FlowDocument x:Name="flowDocument">
</FlowDocument>
</FlowDocumentScrollViewer>
</Viewbox>
<Viewbox Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" HorizontalAlignment="Left" StretchDirection="DownOnly">
<TextBlock x:Name="txtBottom" />
</Viewbox>
</Grid>