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

Styling PDFViewer

5 Answers 413 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 23 Apr 2013, 02:47 AM
  1. How can one disable the busyIndicator that pops up when a PDF is loading. 
  2. Also, how can one change the color of the canvas behind the PDF to black?  I used the following style setter from elsewhere on the forum but it only takes affect after the PDF is loaded.  Meanwhile the gray background is visible while the busy indicator spins.
  3. Finally I'd like to get rid of the margins around the sides of the page so the PDF is 100% full screen.

<Style TargetType="telerik_ui:FixedDocumentPagesPresenter">
    <Setter Property="Background" Value="Black" />
    <Setter Property="BorderBrush" Value="Black" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik_ui:FixedDocumentPagesPresenter">
                <Grid>
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <ContentPresenter Margin="{TemplateBinding Padding}" />
                    </Border>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

5 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 23 Apr 2013, 12:24 PM
Hi Mark,

First of all, I want to thank you for your interest in RadPdfViewer.

Now, to your questions:

1. You can disable the busy indicator when a PDF document is loading, if you edit RadPdfViewer's template and set the Visibility property of the RadBusyIndicator to "Collapsed".

2. The style which you edit is the right one. The "gray" background comes from the RadBusyIndicator. After you executed the above-described step, that background will be gone. 

3. You should calculate and set RadPdfViewer's ScaleFactor to a value, which will force the control to take the whole available space. This can be achieved with the following line of code:
this.pdfViewer.ScaleFactor = (this.pdfViewer.ActualWidth + this.pdfViewer.VerticalScrollBar.Width) / this.pdfViewer.CurrentPage.ActualWidth;

Hope this helps. If you have any further questions, please do not hesitate to contact us again.
 
Kind regards,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 24 Apr 2013, 11:23 AM
Thanks for your reply.  I'm not sure how to edit the radPDFViewer template as I don't have Blend to follow the documentation.  Can you provide a sample?  Thanks!

This is what I've tried to do but other than the property setters nothing seems to apply:

<Style TargetType="telerik_ui:FixedDocumentPagesPresenter">
    <Setter Property="Background" Value="Black" />
    <Setter Property="BorderBrush" Value="Black" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik_ui:FixedDocumentPagesPresenter">
                <Grid>
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <ScrollBar Grid.Column="1" Orientation="Vertical" Visibility="Collapsed"/>
                            <ScrollBar Orientation="Horizontal" Grid.Row="1" Visibility="Collapsed"/>
                            <ContentPresenter Margin="{TemplateBinding Padding}" />
                            <telerik:RadBusyIndicator VerticalAlignment="Center" HorizontalAlignment="Center" Background="Black" OverlayStyle="{StaticResource busyIndicatorOverlay}" FontSize="24">
                                <telerik:RadBusyIndicator.Foreground>
                                    <SolidColorBrush Color="White" telerik:Windows8TouchPalette.IsFreezable="True"/>
                                </telerik:RadBusyIndicator.Foreground>
                            </telerik:RadBusyIndicator>
                        </Grid>
                    </Border>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
0
Accepted
Todor
Telerik team
answered on 24 Apr 2013, 12:31 PM
Hello Mark,

For your convenience, I've made a sample demo, which will help you on the three topics discussed in one of your previous posts to us. You can find it attached.

In addition, I left some "NOTE:" comments in "Themes/Telerik.Windows.Controls.FixedDocumentViewers.xaml" file, so please, search for them.

I'm using implicit styles, which means that NoXAML binaries must be referenced in the project.

Hope this helps.

 

Regards,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
armando
Top achievements
Rank 1
answered on 26 Jan 2015, 09:24 PM
Hi todor,
I downloaded your example and applied the styles found in Telerik.Windows.Controls.FixedDocumentViewers.xaml
to change RadPdfViewer, but I get the following error on thi statment

 <Style x:Key="FixedDocumentViewerBaseStyle" TargetType="viewer:FixedDocumentViewerBase">
        <Setter Property="Template" Value="{StaticResource FixedDocumentViewerBaseTemplate}" />
    </Style>

Unhandled exception has occured and has been caught by the global exception handler
System.InvalidCastException: Unable to cast object of type 'System.Windows.Controls.ContentControl' to type 'System.Windows.Controls.ContentPresenter'.
   at Telerik.Windows.Controls.FixedDocumentViewerBase.GetTemplateChild[T](String childName)
   at Telerik.Windows.Controls.FixedDocumentViewerBase.OnApplyTemplate()
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
   at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)


  Here is my code to customize PdfViewer

 <Grid Background="{DynamicResource ThemeBackgroundBrush100}"
                              x:Uid="27ae3e767705415aa3a8f2098be34556">
                            <Grid.Resources>
                                <Style x:Key="FixedDocumentPagesPresenterStyle"
                                       TargetType="ui:FixedDocumentPagesPresenter">
                                    <Setter Property="Background" Value="Transparent" x:Uid="0947cd7100d54892b5f76e7f02a9e338" />
                                    <Setter Property="BorderThickness" Value="0" x:Uid="f792acc9c7d64e58b758d2c363c406bb" />
                                    <Setter Property="Padding" Value="0" x:Uid="d95783d36d354dd5ab496b4f7cdaa0ab" />
                                    <Setter Property="Template"
                                            x:Uid="9566b28903ef422a98551d119595f686">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="ui:FixedDocumentPagesPresenter">
                                                <Grid x:Uid="1653dc848da244b1b0e98608429b633d">
                                                    <Border Background="{TemplateBinding Background}"
                                                            BorderBrush="{TemplateBinding BorderBrush}"
                                                            BorderThickness="{TemplateBinding BorderThickness}"
                                                            x:Uid="9c005d88611041e4be59b70b4e7290f3">
                                                        <ContentPresenter Margin="{TemplateBinding Padding}"
                                                                          x:Uid="7ba6f631900c463fafde31af13d063b8">
                                                        </ContentPresenter>
                                                    </Border>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                                <ControlTemplate x:Key="FixedDocumentViewerBaseTemplate"
                                                 TargetType="viewer:FixedDocumentViewerBase">
                                    <Grid x:Uid="b9e0f98b3c784bbbad42f4badb53df91">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition />
                                        </Grid.RowDefinitions>
                                        <Grid Grid.Row="1"
                                              x:Uid="15d309c86e5544519c5a3497deade3d3">
                                            <Grid.RowDefinitions>
                                                <RowDefinition />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition />
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <ContentControl x:Name="PART_ContentPresenter" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" x:Uid="c992bf40b9a44510876e7e6136ee6ff4" />
                                            <ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="1" Orientation="Vertical" Visibility="Collapsed" x:Uid="4e70c060b7a5410ea32995136c7e7e0c" />
                                            <ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Row="1" Orientation="Horizontal" Visibility="Collapsed" x:Uid="8045f87e999b45c2957742c1f91a55e7" />
                                        </Grid>
                                        <!--  NOTE: Here is the BusyIndicator on which you can set the Visibility property to collapsed. Point #1 and #2 in your post.  -->
                                        <telerik:RadBusyIndicator x:Name="PART_BusyIndicator" Grid.RowSpan="2" Visibility="Collapsed" x:Uid="0134b161f2c04a968c6be386cb52f051" />
                                    </Grid>
                                </ControlTemplate>
                                <Style x:Key="FixedDocumentViewerBaseStyle"
                                       TargetType="viewer:FixedDocumentViewerBase">
                                    <Setter Property="Template"
                                            Value="{StaticResource FixedDocumentViewerBaseTemplate}"
                                            x:Uid="0f8251a12297445794a36efa4a023d39">
                                    </Setter>
                                </Style>
                                <Style BasedOn="{StaticResource FixedDocumentPagesPresenterStyle}"
                                       TargetType="ui:FixedDocumentPagesPresenter">
                                </Style>
                                <!--  NOTE: This is the style, necessary to display the Page  -->
                                <!--
                                    <Style x:Key="PageStyle"
                                    TargetType="fixedui:Page">
                                    <Setter Property="Background" Value="Transparent" x:Uid="04473e7b00ac41b19a6b3e1274441218" />
                                    <Setter Property="BorderBrush"
                                    Value="{telerik:Windows8TouchResource ResourceKey=MediumBrush}"
                                    x:Uid="26b82b2d867f483fb76cdb697ad96763">
                                    </Setter>
                                    <Setter Property="BorderThickness" Value="1" x:Uid="80f427ec8c28419f97cd0b09531fe72b" />
                                    <Setter Property="Padding" Value="0" x:Uid="0235ca61ec6c45cebffe4622d7cda847" />
                                    <Setter Property="Template"
                                    x:Uid="fd821523d055418b9752e91d7f9e3e69">
                                    <Setter.Value>
                                    <ControlTemplate TargetType="fixedui:Page">
                                    <Border x:Name="PART_LayoutRoot"
                                    x:Uid="ff79f2baad7f4c339afc94ca156e2cd7">
                                    <Grid x:Uid="45e704bcfb6240a0afe991a520d28505">
                                -->
                                <!--  Page  -->
                                <!--
                                    <Border Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Margin="-10"
                                    Width="{TemplateBinding Width}"
                                    Height="{TemplateBinding Height}"
                                    x:Uid="2cbc51108874423992901fc756a7a518">
                                    </Border>
                                    </Grid>
                                    </Border>
                                    </ControlTemplate>
                                    </Setter.Value>
                                    </Setter>
                                    </Style>
                                    <Style TargetType="fixedui:Page"
                                    BasedOn="{StaticResource PageStyle}">
                                    </Style>
                                -->
                                <Style BasedOn="{StaticResource FixedDocumentViewerBaseStyle}"
                                       TargetType="viewer:FixedDocumentViewerBase">
                                </Style>
                                <Style x:Key="RadPdfViewerStyle"
                                       TargetType="viewer:RadPdfViewer">
                                    <Setter Property="Template"
                                            Value="{StaticResource FixedDocumentViewerBaseTemplate}"
                                            x:Uid="bca6768d80e3425faace9d75a5014566">
                                    </Setter>
                                </Style>
                                <Style BasedOn="{StaticResource RadPdfViewerStyle}"
                                       TargetType="viewer:RadPdfViewer">
                                </Style>
                            </Grid.Resources>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid x:Name="pdfNavBar"
                                  Height="48"
                                  Background="{DynamicResource ControlBackgroundBrush20}"
                                  DataContext="{Binding ElementName=pdfViewer,
                                                        Path=CommandDescriptors}"
                                  x:Uid="651d70d56cd142e3806055209dbf3ea1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Button x:Name="btnPrevious"
                                        Grid.Column="0"
                                        Command="{Binding PageUpCommandDescriptor.Command}"
                                        Style="{DynamicResource ImageButtonStyle}"
                                        Visibility="{Binding PageUpCommandDescriptor.IsEnabled,
                                                             Converter={StaticResource BoolToVisibilityConverter}}"
                                        x:Uid="0706b39e84ef40f1807a4501eef50077">
                                    <ContentControl Style="{DynamicResource ArrowUpVector}"
                                                    x:Uid="924383f04b0042e59bc5699daa91ef00">
                                    </ContentControl>
                                </Button>
                                <Button x:Name="btnNext"
                                        Grid.Column="1"
                                        Command="{Binding PageDownCommandDescriptor.Command}"
                                        Style="{DynamicResource ImageButtonStyle}"
                                        Visibility="{Binding PageDownCommandDescriptor.IsEnabled,
                                                             Converter={StaticResource BoolToVisibilityConverter}}"
                                        x:Uid="690cc6734fc848e2b8bd1821a6b5957e">
                                    <ContentControl Style="{DynamicResource ArrowDownVector}"
                                                    x:Uid="0d5dfd13d7c14f028d76915ea30e33b5">
                                    </ContentControl>
                                </Button>
                                <Grid Grid.Column="2"
                                      Height="48"
                                      x:Uid="3955bedfa94045f5a97d2d5dd9f166c0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBox x:Name="currentPage"
                                             Grid.Column="0"
                                             Width="50"
                                             Margin="10"
                                             Style="{DynamicResource SmallTooltipTextBoxStyle}"
                                             Text="{Binding FixedDocumentViewer.CurrentPageNumber,
                                                            Mode=TwoWay}"
                                             x:Uid="56b497a6d3dc43a0950643b28b1d0894">
                                    </TextBox>
                                    <TextBlock x:Name="TextBlock11"
                                               Grid.Column="1"
                                               Margin="2,10,2,10"
                                               VerticalAlignment="Center"
                                               Style="{DynamicResource ControlContentSmallTextBlock}"
                                               Text="{loc:LocText Key=TextBlock11_Text,
                                                                  Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                  Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                               x:Uid="6fe6266bbc1240219f5104295e107b15">
                                    </TextBlock>
                                    <TextBlock Grid.Column="2"
                                               Margin="2,10,2,10"
                                               VerticalAlignment="Center"
                                               Style="{DynamicResource ControlContentSmallTextBlock}"
                                               Text="{Binding ElementName=pdfViewer,
                                                              Path=Document.Pages.Count}"
                                               x:Uid="a630ba503ab14507b806c79b584133d9">
                                    </TextBlock>
                                </Grid>
                                <!--  Border separator  -->
                                <Border Grid.Column="3"
                                        Width="1"
                                        Height="38"
                                        Margin="5,5,5,5"
                                        BorderBrush="{DynamicResource ControlBackgroundAlternativeBrush10}"
                                        BorderThickness="1"
                                        x:Uid="f97d08e871fc47fca14c62a2f4678197">
                                </Border>
                                <Button x:Name="zoomIn"
                                        Grid.Column="4"
                                        Command="{Binding ZoomInCommandDescriptor.Command}"
                                        Style="{DynamicResource ImageButtonStyle}"
                                        Visibility="{Binding ZoomInCommandDescriptor.IsEnabled,
                                                             Converter={StaticResource BoolToVisibilityConverter}}"
                                        x:Uid="690cc6734fc848e2b8bd1821a6b5957e">
                                    <ContentControl Style="{DynamicResource ZoomInVector}"
                                                    x:Uid="0d5dfd13d7c14f028d76915ea30e33b5">
                                    </ContentControl>
                                </Button>
                                <Button x:Name="zoomOut"
                                        Grid.Column="5"
                                        Command="{Binding ZoomOutCommandDescriptor.Command}"
                                        Style="{DynamicResource ImageButtonStyle}"
                                        Visibility="{Binding ZoomOutCommandDescriptor.IsEnabled,
                                                             Converter={StaticResource BoolToVisibilityConverter}}"
                                        x:Uid="690cc6734fc848e2b8bd1821a6b5957e">
                                    <ContentControl Style="{DynamicResource ZoomOutVector}"
                                                    x:Uid="0d5dfd13d7c14f028d76915ea30e33b5">
                                    </ContentControl>
                                </Button>
                                <Border Grid.Column="6"
                                        Height="48"
                                        Padding="12,0,12,0"
                                        x:Uid="3319496a1d8f435c9789796be3288124">
                                    <ComboBox x:Name="ComboBox1"
                                              Width="150"
                                              Height="38"
                                              Foreground="{DynamicResource ControlForegroundBrush50}"
                                              SelectedValue="{Binding ElementName=pdfViewer,
                                                                      Path=ScaleFactor,
                                                                      Mode=TwoWay,
                                                                      Converter={StaticResource ComboPercentageToDoubleConverter},
                                                                      ConverterParameter=Perc,
                                                                      UpdateSourceTrigger=PropertyChanged}"
                                              Style="{DynamicResource ComboBoxSettingsStyle}"
                                              Text="{loc:LocText Key=ComboBox1_Text,
                                                                 Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                 Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                              x:Uid="91fdad3c52d14c12a8efef723d027675">
                                        <ComboBox.Items>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock1"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock1_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="9772ade402224bd18e2902d8ec651c67">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock2"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock2_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="fb72a6663515426998e85f8c04e70d7c">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock3"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock3_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="b1f748cb4d124a8dbd3abd11bea5eaf6">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock4"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock4_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="f5057ce2429844d0830ad7ae6e626a31">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock5"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock5_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="c0fe22b28e154193a410b611fca51df5">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock6"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock6_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="05d175b889ca435a83c975e3141cf93b">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock7"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock7_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="70174b9b8c28411d872982402c4e3275">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock8"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock8_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="f7262e1004364891a35cf606f3995df8">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock9"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock9_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="26f212eca7e94d0badadac17fd12fadf">
                                                </TextBlock>
                                            </ComboBoxItem>
                                            <ComboBoxItem>
                                                <TextBlock x:Name="TextBlock10"
                                                           Style="{DynamicResource ControlContentSmallTextBlock}"
                                                           Text="{loc:LocText Key=TextBlock10_Text,
                                                                              Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                              Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                           x:Uid="28abed46e2ab419e981ce98f80d6a9a3">
                                                </TextBlock>
                                            </ComboBoxItem>
                                        </ComboBox.Items>
                                    </ComboBox>
                                </Border>
                                <!--  Border separator  -->
                                <Border Grid.Column="7"
                                        Width="1"
                                        Height="38"
                                        Margin="5,5,5,5"
                                        BorderBrush="{DynamicResource ControlBackgroundAlternativeBrush10}"
                                        BorderThickness="1"
                                        x:Uid="f97d08e871fc47fca14c62a2f4678197">
                                </Border>
                                <ToggleButton Grid.Column="8"
                                              Background="Transparent"
                                              BorderThickness="0"
                                              Command="{Binding FitToWidthFixedDocumentPagesPresenterCommandDescriptor.Command}"
                                              IsChecked="{Binding FitToWidthFixedDocumentPagesPresenterCommandDescriptor.IsEnabled,
                                                                  Mode=TwoWay}"
                                              IsEnabled="{Binding FitToWidthFixedDocumentPagesPresenterCommandDescriptor.IsEnabled,
                                                                  Converter={StaticResource InvertedBooleanConverter},
                                                                  Mode=TwoWay}"
                                              Style="{DynamicResource ToggleButtonStyle}"
                                              x:Uid="690cc6734fc848e2b8bd1821a6b5957e">
                                    <ContentControl Style="{DynamicResource PageFitWidthVector}"
                                                    x:Uid="0d5dfd13d7c14f028d76915ea30e33b5">
                                    </ContentControl>
                                </ToggleButton>
                                <ToggleButton Grid.Column="9"
                                              Background="Transparent"
                                              BorderThickness="0"
                                              Command="{Binding FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.Command}"
                                              IsChecked="{Binding FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.IsEnabled,
                                                                  Mode=TwoWay}"
                                              IsEnabled="{Binding FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.IsEnabled,
                                                                  Converter={StaticResource InvertedBooleanConverter},
                                                                  Mode=TwoWay}"
                                              Style="{DynamicResource ToggleButtonStyle}"
                                              x:Uid="690cc6734fc848e2b8bd1821a6b5957e">
                                    <ContentControl Style="{DynamicResource ExpandVector}"
                                                    x:Uid="0d5dfd13d7c14f028d76915ea30e33b5">
                                    </ContentControl>
                                </ToggleButton>
                                <!--  Border separator  -->
                                <Border Grid.Column="10"
                                        Width="1"
                                        Height="38"
                                        Margin="5,5,5,5"
                                        BorderBrush="{DynamicResource ControlBackgroundAlternativeBrush10}"
                                        BorderThickness="1"
                                        x:Uid="f97d08e871fc47fca14c62a2f4678197">
                                </Border>
                                <ToggleButton Grid.Column="11"
                                              Background="Transparent"
                                              BorderThickness="0"
                                              IsChecked="{Binding FixedDocumentViewer.Mode,
                                                                  Mode=TwoWay,
                                                                  Converter={StaticResource ModeConverter},
                                                                  ConverterParameter=Pan}"
                                              Style="{DynamicResource ToggleButtonStyle}"
                                              x:Uid="690cc6734fc848e2b8bd1821a6b5957e">
                                    <ContentControl Style="{DynamicResource PanVector}"
                                                    x:Uid="0d5dfd13d7c14f028d76915ea30e33b5">
                                    </ContentControl>
                                </ToggleButton>
                                <ToggleButton Grid.Column="12"
                                              Background="Transparent"
                                              BorderThickness="0"
                                              IsChecked="{Binding FixedDocumentViewer.Mode,
                                                                  Mode=TwoWay,
                                                                  Converter={StaticResource ModeConverter},
                                                                  ConverterParameter=TextSelection}"
                                              Style="{DynamicResource ToggleButtonStyle}"
                                              x:Uid="690cc6734fc848e2b8bd1821a6b5957e">
                                    <ContentControl Style="{DynamicResource PageAnnotationVector}"
                                                    x:Uid="0d5dfd13d7c14f028d76915ea30e33b5">
                                    </ContentControl>
                                </ToggleButton>
                            </Grid>
                            <Border Grid.Row="2"
                                    x:Uid="ff5285d1522d49e3bab51e88e035236f">
                                <telerik:RadPdfViewer x:Name="pdfViewer"
                                                      DocumentSource="{Binding PdfSource,
                                                                               Converter={StaticResource PdfDocumentSourceValueConverter}}"
                                                      Style="{DynamicResource RadPdfViewerStyle}"
                                                      Visibility="{Binding Path=IsVisible,
                                                                           Converter={StaticResource BoolToVisibilityConverter}}"
                                                      x:Uid="80b6d45f3e404697ae12176b702a01f6">
                                    <telerik:RadContextMenu.ContextMenu>
                                        <telerik:RadContextMenu x:Name="menu">
                                            <telerik:RadMenuItem x:Name="RadMenuItem1"
                                                                 Command="{Binding CopyCommandDescriptor.Command}"
                                                                 Header="{loc:LocText Key=RadMenuItem1_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 Visibility="{Binding CopyCommandDescriptor.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="754f07f333e74b3284e13af45603a86e">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem x:Name="RadMenuItem2"
                                                                 Command="{Binding SelectAllCommandDescriptor.Command}"
                                                                 Header="{loc:LocText Key=RadMenuItem2_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 Visibility="{Binding SelectAllCommandDescriptor.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="b590827495ea4cebb4adb1addd1e66c7">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem IsSeparator="True"
                                                                 Visibility="{Binding TextSelectionCommandDescriptorsGroup.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="05d10e2c2bc94dd695e2a77df7afe4c6">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem x:Name="RadMenuItem3"
                                                                 Header="{loc:LocText Key=RadMenuItem3_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 IsCheckable="True"
                                                                 IsChecked="{Binding FixedDocumentViewer.Mode,
                                                                                     Mode=TwoWay,
                                                                                     Converter={StaticResource ModeConverter},
                                                                                     ConverterParameter=Pan}"
                                                                 x:Uid="9ec415c1dc8e40ae8ca96073757f1f93">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem x:Name="RadMenuItem4"
                                                                 Header="{loc:LocText Key=RadMenuItem4_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 IsCheckable="True"
                                                                 IsChecked="{Binding FixedDocumentViewer.Mode,
                                                                                     Mode=TwoWay,
                                                                                     Converter={StaticResource ModeConverter},
                                                                                     ConverterParameter=TextSelection}"
                                                                 x:Uid="24323fcf919c455ea31db8235555eb5f">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem IsSeparator="True"
                                                                 Visibility="{Binding ViewSelectionCommandDescriptorsGroup.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="dc23e65d2f504d7a8957f6426a11de4d">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem x:Name="RadMenuItem5"
                                                                 Command="{Binding ZoomInCommandDescriptor.Command}"
                                                                 Header="{loc:LocText Key=RadMenuItem5_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 Visibility="{Binding ZoomInCommandDescriptor.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="054ea504548a4682a4cc1547eaf76800">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem x:Name="RadMenuItem6"
                                                                 Command="{Binding ZoomOutCommandDescriptor.Command}"
                                                                 Header="{loc:LocText Key=RadMenuItem6_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 Visibility="{Binding ZoomOutCommandDescriptor.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="2e61f4d4e8f547258f2fea31597ff9c9">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem IsSeparator="True" x:Uid="999573c9d7644f1aa91561ae5d925cf0" />
                                            <telerik:RadMenuItem x:Name="RadMenuItem7"
                                                                 Command="{Binding PrintCommandDescriptor.Command}"
                                                                 Header="{loc:LocText Key=RadMenuItem7_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 Visibility="{Binding PrintCommandDescriptor.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="11a7609f96654ab3a8b0e325b2434480">
                                            </telerik:RadMenuItem>
                                            <telerik:RadMenuItem x:Name="RadMenuItem8"
                                                                 Command="{Binding ShowFindDialogCommandDescriptor.Command}"
                                                                 Header="{loc:LocText Key=RadMenuItem8_Header,
                                                                                      Dict=Resources.Resources.ContentComponentItemTemplates,
                                                                                      Assembly=MyBI.DesktopClient.WorkspaceModules.ContentDisplay}"
                                                                 Visibility="{Binding ShowFindDialogCommandDescriptor.IsEnabled,
                                                                                      Converter={StaticResource BoolToVisibilityConverter}}"
                                                                 x:Uid="c9a8edcfb70142089463c151d42ffc05">
                                            </telerik:RadMenuItem>
                                        </telerik:RadContextMenu>
                                    </telerik:RadContextMenu.ContextMenu>
                                </telerik:RadPdfViewer>
                            </Border>
                            <Image LayoutTransform="{Binding LayoutTransform}"
                                   Source="{Binding ComponentImageSource}"
                                   Stretch="None"
                                   x:Uid="af631ac5fdd5441193f3bc07916e53ff">
                            </Image>
                        </Grid>






0
Todor
Telerik team
answered on 29 Jan 2015, 09:04 AM
Hi Armando,

The reason you get this error is because the FixedDocumentViewerBase control now uses a ContentPresenter instead of ContentControl in its template. This is why you should replace the ContentControl in FixedDocumentViewerBaseTemplate with a ContentPresenter.

I hope this helps.

Regards,
Todor
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PDFViewer
Asked by
Mark
Top achievements
Rank 1
Answers by
Todor
Telerik team
Mark
Top achievements
Rank 1
armando
Top achievements
Rank 1
Share this question
or