From 54627260f0eff645569431d64cda2a924ece2048 Mon Sep 17 00:00:00 2001 From: Adolfo Marinucci Date: Sun, 1 Dec 2024 23:24:48 +0100 Subject: [PATCH] 2.0.57 - Fixes #265 correctly --- .github/workflows/build-deploy.yml | 2 +- src/MauiReactor/ContentPage.partial.cs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 34230d5..49e77a7 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -16,7 +16,7 @@ jobs: Solution_Name: ./src/MauiReactor.Build.sln Test_Project: ./samples/UnitTests/UnitTests.csproj TemplatePack_Name: ./src/MauiReactor.TemplatePack/MauiReactor.TemplatePack.csproj - Version: 2.0.56 + Version: 2.0.57 steps: - name: Checkout diff --git a/src/MauiReactor/ContentPage.partial.cs b/src/MauiReactor/ContentPage.partial.cs index 5c41d61..4a0697b 100644 --- a/src/MauiReactor/ContentPage.partial.cs +++ b/src/MauiReactor/ContentPage.partial.cs @@ -42,8 +42,18 @@ partial class ContentPageWithBackButtonPressedOverriden : Microsoft.Maui.Control { protected override bool OnBackButtonPressed() { - //we want to handle back button pressed event (including physical button on Android) - return true; + var backButtonBehavior = (BackButtonBehavior?)this.GetValue(Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty); + + if (backButtonBehavior != null && + backButtonBehavior.Command != null && + backButtonBehavior.Command.CanExecute(null)) + { + //we want to handle back button pressed event (including physical button on Android) + backButtonBehavior.Command.Execute(null); + return true; + } + + return false; } }