GoToPage has no effect

2 posts, 0 answers
  1. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 25 Apr 2016 Link to this post

    Hello Telerik,


    I am having an issue when trying to change my document's page when clicking on a ListView item. The page won't change at all.

    Here's the code of the sample project I have created specially for this issue:

    I also tried the approach in this ticket

    but it still won't work in my scenario.

    <Window x:Class="TelerikPdf.MainWindow"
            Title="MainWindow" d:DesignHeight="675" d:DesignWidth="950"
            xmlns:telerik="" >
                <fixed:PdfDocumentSourceValueConverter x:Key="PdfDocumentSourceValueConverter" />
                <RowDefinition Height="1*"/>
                <RowDefinition Height="13*"/>
            <TextBlock Name="LabelDomain" Text="Tutorial " HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontSize="18"
                       Grid.Row="0" Grid.Column="0"/>
            <Grid Grid.Row="1" Grid.Column="0">
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="7*" />
                    <RowDefinition />
                <ListView Grid.Row="0" Grid.Column="0" Name="TutorialItems" SelectionChanged="TutorialItems_SelectionChanged">
                                <TextBlock Text="{Binding}" FontWeight="Bold" />
                <Border  Grid.Row="0" Grid.Column="1" BorderBrush="White" BorderThickness="0" Margin="5,0,5,0">
                            <RowDefinition Height="0.2*"/>
                        <Border BorderBrush="LightGray" BorderThickness="1" Visibility="Visible" Margin="10,0,10,0">
                            <ScrollViewer Grid.Row="0">
                                <telerik:RadPdfViewer Name="RadPdfViewer" Grid.Row="1" ScaleMode="Normal" />

    code behind:

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Telerik.Windows.Documents.Fixed.FormatProviders;
    using Telerik.Windows.Documents.Fixed.FormatProviders.Pdf;
    using Telerik.Windows.Documents.Fixed.Model;
    namespace TelerikPdf
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
            public MainWindow()
                List<string> items = new List<string>();
                items.Add("How to use");
                items.Add("Understanding the customer CSV file");
                items.Add("Understanding the Domain CSV file");
                TutorialItems.ItemsSource = items;
                MemoryStream stream = new MemoryStream();
                using (Stream input = File.OpenRead("qwe.pdf"))
                FormatProviderSettings settings = new FormatProviderSettings(ReadingMode.OnDemand);
                PdfFormatProvider provider = new PdfFormatProvider(stream, settings);
                RadFixedDocument doc = provider.Import();
                RadPdfViewer.Document = doc;
            private void TutorialItems_SelectionChanged(object sender, SelectionChangedEventArgs e)
                switch (TutorialItems.SelectedItem.ToString())
                    case "Introduction":
                    case "How to use":
                    case "Understanding the customer CSV file":


    Best regards!

  2. Tanya
    Tanya avatar
    577 posts

    Posted 27 Apr 2016 Link to this post

    Hello Jacob,

    ScrollViewer measures its children in Infinity and this leads to disabling the virtualization of RadPdfViewer thus forcing it to load the whole document.

    RadPdfViewer comes with a built-in scroll bar, which is used by the GoToPage() method. You could use the default functionality instead of ScrollViewer to avoid the behavior you are currently experiencing as well as unexpected results in the future. The only thing you will need to do is remove the ScrollViewer and keep the PdfViewer directly inside the Border.

    Hope this helps.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top