WPF:如何删除 DocumentViewer 中的搜索框?

标签 wpf documentviewer

我的 XAML 代码是这样的:

<Window
    xmlns                 ='http://schemas.microsoft.com/netfx/2007/xaml/presentation'
    xmlns:x               ='http://schemas.microsoft.com/winfx/2006/xaml'
    Title                 ='Print Preview - More stuff here'
    Height                ='200'
    Width                 ='300'
    WindowStartupLocation ='CenterOwner'>
    <DocumentViewer Name='dv1' ... />
</Window>

如何在 XAML 或 C# 中消除搜索框?

最佳答案

您可以执行类似于 Cheeso's answer 的操作与 ContentControl 的风格以及当名称为 PART_FindToolBarHost 时隐藏它的触发器.

<DocumentViewer>
  <DocumentViewer.Resources>
    <Style TargetType="ContentControl">
      <Style.Triggers>
        <Trigger Property="Name" Value="PART_FindToolBarHost">
          <Setter Property="Visibility" Value="Collapsed" />
        </Trigger>
      </Style.Triggers>
    </Style>
  </DocumentViewer.Resources>
</DocumentViewer>

关于WPF:如何删除 DocumentViewer 中的搜索框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2322727/

相关文章:

.net - 在 DocumentViewer 中显示多个固定文档,就好像它们是单个文档一样

wpf - 更改 WPF DocumentViewer 查看模式

c# - WPF 文档查看器更新问题

wpf - 如何覆盖 wpf 控件中的键绑定(bind)?

c# - DependencyProperty 不适用于 CustomControl

.net - WPF 列表框空数据模板

web-services - 文档格式转换API

c# - 为另一个 DataGrid 中的 DataGrid 设置不同的 SelectionChanged 事件处理程序

wpf - 将 XAML Canvas 导入到 Expression Design 中?

c# - 向 DocumentViewer 显示 Tiff 图像时出错(WPF、C#)