This is a migrated thread and some comments may be shown as answers.

Remove Border

1 Answer 389 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Dirk
Top achievements
Rank 1
Dirk asked on 08 Mar 2018, 11:40 AM

I cannot find a way to remove the gray border in the RadPdfViewer.
The border is inside of the scrollviewer and I cannot find a way to set Borderwith or Margin or Padding to Zero.

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 13 Mar 2018, 09:13 AM
Hello Dirk,

To achieve that, you will need to change the template of the presenter responsible for rendering the pages - FixedDocumentPresenterBase. Here is its default declaration:
<Style x:Key="FixedDocumentPresenterBaseStyle" TargetType="ui:FixedDocumentPresenterBase">
    <Setter Property="BorderBrush" Value="{telerik:Windows8Resource ResourceKey=BasicBrush}"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Padding" Value="0"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="Focusable" Value="True"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="VerticalAlignment" Value="Stretch"/>
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
    <Setter Property="UseLayoutRounding" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ui:FixedDocumentPresenterBase">
                <Grid>
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Focusable="False">
                        <ContentPresenter Margin="{TemplateBinding Padding}"/>
                    </Border>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Adding a negative margin to the border in the template will help you to hide the gray area.

Hope this helps.

Regards,
Tanya
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PDFViewer
Asked by
Dirk
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or