我的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 - WPF:如何在文档查看器中删除搜索框?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2322727/