I would like to Collapse the Copy button in WPF Documentviewer control toolbar. I added a trigger in style to set visibility to Collapsed.But it didn't work.Any thoughts why?
<DocumentViewer Grid.Row="1" Margin="0,0,40,0" Name="documentViewer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<DocumentViewer.Resources>
<Style TargetType="ContentControl">
<Style.Triggers>
<Trigger Property="Name" Value="PART_FindToolBarHost">
<Setter Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="Name" Value="CopyButton">
<Setter Property="Visibility" Value="Collapsed" />
</Trigger>
</Style.Triggers>
</Style>
</DocumentViewer.Resources>
</DocumentViewer>

As far as I am aware there is no way to collapse the copy button without changing the style of the entire control... So here is a style suitable for you (warning a lot of code incomming)
(source = https://learn.microsoft.com/de-de/dotnet/framework/wpf/controls/documentviewer-styles-and-templates):
Result:
Of cause you would have to modify it to fit your needs.
If you dont feel like working on a style based solution check out this link: WPF: How can I remove the searchbox in a DocumentViewer?