diff --git a/Example/Business/UI/Pages/MainPage.xaml b/Example/Business/UI/Pages/MainPage.xaml
index c86e493..0ffaeb7 100644
--- a/Example/Business/UI/Pages/MainPage.xaml
+++ b/Example/Business/UI/Pages/MainPage.xaml
@@ -5,27 +5,26 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pdf="clr-namespace:Maui.PDFView;assembly=Maui.PDFView"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
- Title="Example">
+ Title="Example"
+ Unloaded="ContentPage_Unloaded">
-
+
+ ColumnDefinitions="Auto,Auto,Auto,Auto"
+ ColumnSpacing="8"
+ RowDefinitions="Auto,Auto">
-
+ Text="{Binding MaxZoom, StringFormat='Max zoom is {0}'}" />
+ Minimum="1"
+ Value="{Binding MaxZoom}" />
+ Text="ChangeUri"
+ VerticalOptions="Center" />
+
+
+ PageChangedCommand="{Binding PageChangedCommand}"
+ Uri="{Binding PdfSource}" />
\ No newline at end of file
diff --git a/Example/Business/UI/Pages/MainPage.xaml.cs b/Example/Business/UI/Pages/MainPage.xaml.cs
index a86a904..fbd0024 100644
--- a/Example/Business/UI/Pages/MainPage.xaml.cs
+++ b/Example/Business/UI/Pages/MainPage.xaml.cs
@@ -8,4 +8,10 @@ public MainPage()
InitializeComponent();
BindingContext = new MainPageViewModel();
}
+
+ private void ContentPage_Unloaded(object sender, EventArgs e)
+ {
+ pdfView.Handler?.DisconnectHandler();
+ }
+
}
\ No newline at end of file
diff --git a/Example/Business/UI/ViewModels/MainPageViewModel.cs b/Example/Business/UI/ViewModels/MainPageViewModel.cs
index 716e8fd..ebaf57e 100644
--- a/Example/Business/UI/ViewModels/MainPageViewModel.cs
+++ b/Example/Business/UI/ViewModels/MainPageViewModel.cs
@@ -1,6 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Example.Business.Services;
+using Example.Business.UI.Pages;
using Maui.PDFView.Events;
using System.Diagnostics;
using System.Windows.Input;
@@ -29,5 +30,10 @@ [RelayCommand] private void PageChanged(PageChangedEventArgs args)
{
Debug.WriteLine($"Current page: {args.CurrentPage} of {args.TotalPages}");
}
+
+ [RelayCommand] private void OpenNewPage()
+ {
+ App.Current.MainPage.Navigation.PushAsync(new MainPage());
+ }
}
}
diff --git a/Example/Example.csproj b/Example/Example.csproj
index f303e3f..c028400 100644
--- a/Example/Example.csproj
+++ b/Example/Example.csproj
@@ -32,6 +32,8 @@
1.0
1
+ None
+
11.0
13.1
21.0
diff --git a/Example/Properties/launchSettings.json b/Example/Properties/launchSettings.json
index edf8aad..4f85793 100644
--- a/Example/Properties/launchSettings.json
+++ b/Example/Properties/launchSettings.json
@@ -1,7 +1,7 @@
{
"profiles": {
"Windows Machine": {
- "commandName": "MsixPackage",
+ "commandName": "Project",
"nativeDebugging": false
}
}
diff --git a/Maui.PDFView/Maui.PDFView.csproj b/Maui.PDFView/Maui.PDFView.csproj
index f039b72..0ae0149 100644
--- a/Maui.PDFView/Maui.PDFView.csproj
+++ b/Maui.PDFView/Maui.PDFView.csproj
@@ -1,4 +1,4 @@
-
+
net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst
@@ -21,7 +21,7 @@
MAUI library for displaying PDF files
https://github.com/vitalii-vov/Maui.PDFView
MIT
- 1.0.6
+ 1.0.7-alpha
README.md
diff --git a/Maui.PDFView/Platforms/Windows/PdfViewHandler.cs b/Maui.PDFView/Platforms/Windows/PdfViewHandler.cs
index cd76492..e127c4d 100644
--- a/Maui.PDFView/Platforms/Windows/PdfViewHandler.cs
+++ b/Maui.PDFView/Platforms/Windows/PdfViewHandler.cs
@@ -57,15 +57,24 @@ protected override ScrollViewer CreatePlatformView()
VerticalScrollBarVisibility = Microsoft.UI.Xaml.Controls.ScrollBarVisibility.Visible,
};
- // Attach scroll event to track page changes
- _scrollViewer.ViewChanged += OnScrollViewerViewChanged;
-
_stack = new StackPanel { Orientation = Orientation.Vertical };
_scrollViewer.Content = _stack;
return _scrollViewer;
}
+ protected override void ConnectHandler(ScrollViewer platformView)
+ {
+ _scrollViewer.ViewChanged += OnScrollViewerViewChanged;
+ base.ConnectHandler(platformView);
+ }
+
+ protected override void DisconnectHandler(ScrollViewer platformView)
+ {
+ _scrollViewer.ViewChanged -= OnScrollViewerViewChanged;
+ base.DisconnectHandler(platformView);
+ }
+
async Task RenderPages()
{
_stack.Children.Clear();