wpfdocumentviewer

Remove border and shadow from DocumentViewer in WPF


Good evening. I have been chasing an issue with DocumentViewer and don't know how to address it.

When you display a document in a DocumentViewer control, it displays a border and a shadow around the document and I do not know how to get rid of it.

I have written a control template, which I would have expected to have addressed the issue and it does not. Here it is:

  <Style x:Key="MyDocStyle" TargetType="DocumentViewer">
     <Setter Property="Template">
        <Setter.Value>
           <ControlTemplate TargetType="DocumentViewer">
              <Border BorderThickness="5" >
              <Grid>
                 <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" x:Name="PART_ContentHost"
                               Background="Transparent"
                 BorderBrush="Transparent" BorderThickness="0" Padding="0" >
                 </ScrollViewer>
              </Grid>
              </Border>
           </ControlTemplate>
        </Setter.Value>
     </Setter>
  </Style>

What else am I missing? Thank you in advance.


Solution

  • Thank you very much. I'm not sure how I missed that. Nonetheless, thank you very much for your help!