从FlowDocumentReader中删除工具栏

时间:2014-07-11 13:55:09

标签: wpf flowdocument

我有一个WPF应用程序。在一个窗口中,我想显示一些这样的文字:

enter image description here

文本将分为2列。我可以使用FlowDocumentReader来做到这一点。问题是,我不希望显示底部的工具栏(具有缩放,翻页,搜索等的工具栏)。我尝试使用FlowDocumentScrollViewer而不是FlowDocumentReader,文本不再显示在2列中。

如何删除底部的工具栏?

1 个答案:

答案 0 :(得分:3)

你可以用模板来做。我发布的XAML太多了(它不会让我),所以这里是如何自己做的。

在Visual Studio中(我使用的是VS 2013),在“文档大纲”窗口中,右键单击FlowDocumentReader。选择编辑模板 - >编辑副本... enter image description here

您将获得“创建ControlTemplate资源”窗口: enter image description here

单击“确定”。模板的第三行是底部网格/工具栏。添加Visibility =“Collapsed”到它并且它将不可见。

<Grid Visibility="Collapsed" Background="{TemplateBinding Background}" DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Uid="Grid_31">...</Grid>