While messing around with FlowDocuments in a WPF app, I was trying to find a way to remove the nice reader controls. I think they are great, those controls come for free and allow you to zoom, change the page layout as well as search. I was after the ability to flow text around an image, but didn’t want all the extra fruit.
Quite by accident I found that placing the FlowDocumentPageViewer inside a StackPanel removed the FlowDocument controls. I’ve not looked up any documentation to see if that is by design, but it works.
<Border CornerRadius="5,5,0,0" BorderThickness="2" BorderBrush="Blue" Visibility="Visible" Panel.ZIndex="0">
This is a richTextBox. I can
<Figure HorizontalAnchor="ContentLeft" VerticalAnchor="ContentTop" Width="100">
<Image Height="100" Width="100" Source="Bear3.jpg" />
<Paragraph Foreground="Blue" FontFamily="Consolas">
The quick brown fox jumps over the lazy dog. This FlowDocument with sample
content, and provides controls to toggle the IsHyphenationEnabled and IsOptimalParagraphEnabled
properties and view the resulting layout changes in real time. The sample also includes controls
for toggling the IsColumnWidthFlexible property, and adjusting the ColumnWidth and ColumnGap properties.
This sample demonstrates a specific feature of the Windows Presentation Foundation (WPF) and, consequently, does not follow
application development best practices. For comprehensive coverage of Windows Presentation
Foundation (WPF) and Microsoft .NET Framework application development best practices, refer to the following as appropriate: