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
http://www.telerik.com/forums/gotopage-issue
but it still won't work in my scenario.
<Window x:Class="TelerikPdf.MainWindow" xmlns:local="clr-namespace:TelerikPdf" mc:Ignorable="d" Title="MainWindow" d:DesignHeight="675" d:DesignWidth="950" xmlns:fixed="clr-namespace:Telerik.Windows.Documents.Fixed;assembly=Telerik.Windows.Controls.FixedDocumentViewers" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" > <Grid> <Grid.Resources> <fixed:PdfDocumentSourceValueConverter x:Key="PdfDocumentSourceValueConverter" /> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="1*"/> <RowDefinition Height="13*"/> </Grid.RowDefinitions> <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"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="7*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> </Grid.RowDefinitions> <ListView Grid.Row="0" Grid.Column="0" Name="TutorialItems" SelectionChanged="TutorialItems_SelectionChanged"> <ListView.ItemTemplate> <DataTemplate> <WrapPanel> <TextBlock Text="{Binding}" FontWeight="Bold" /> </WrapPanel> </DataTemplate> </ListView.ItemTemplate> </ListView> <Border Grid.Row="0" Grid.Column="1" BorderBrush="White" BorderThickness="0" Margin="5,0,5,0"> <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="0.2*"/> </Grid.RowDefinitions> <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" /> </ScrollViewer> </Border> </Grid> </Border> </Grid> </Grid></Window>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() { InitializeComponent(); List<string> items = new List<string>(); items.Add("Introduction"); 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")) { input.CopyTo(stream); } 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": RadPdfViewer.GoToPage(1); break; case "How to use": RadPdfViewer.GoToPage(2); break; case "Understanding the customer CSV file": RadPdfViewer.GoToPage(3); break; } } }}
Best regards!
