Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BackButtonBehavior not working #19171

Closed
acaliaro opened this issue Dec 2, 2023 · 5 comments
Closed

BackButtonBehavior not working #19171

acaliaro opened this issue Dec 2, 2023 · 5 comments
Labels
area-navigation NavigationPage fixed-in-9.0.0-preview.7.24407.4 platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@acaliaro
Copy link

acaliaro commented Dec 2, 2023

Description

I have a problem with BackButtonBehavior but I can't tell you if it's a problem with MAUI, the MVVM toolkit, or the MAUI toolkit.
I have a page that opens in the main page's onAppearing method. A parameter is passed to this page which, in the ApplyQueryAttributes event, sets a property identified as ObservableProperty (IsFirstTime) to true. This property set to true, via the InvertedBoolConverter converter, sets the "IsVisible" of the BackButtonBehavior to false, but the arrow in the navigationbar continues to be seen. If instead of setting the IsFirstProperty to true in the ApplyQueryAttributes method, I set it to true in the SetupViewModel constructor, the arrow disappears correctly.

Steps to Reproduce

run the sample

Link to public reproduction project repository

https://github.com/acaliaro/MauiAppbackbuttonproblem

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

no

Relevant log output

No response

@acaliaro acaliaro added the t/bug Something isn't working label Dec 2, 2023
@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jan 8, 2024
@XamlTest
Copy link

XamlTest commented Jan 8, 2024

Verified this on Visual Studio Enterprise 17.9.0 Preview 2(8.0.3). Repro on Android 14.0-API34, Windows 11, iOS 17.0 and MacCatalyst with below Project:
MauiAppbackbuttonproblem.zip

image

@tentom
Copy link

tentom commented Apr 10, 2024

I think I have a similar problem and it seems to be resolved by setting the binding mode to TwoWay

and I think the reason why this is not working out of the box is because the BackButtonBehaviour bindable property has the default value for the binding mode set to "OneTime". Try setting it to "OneWay"

@acaliaro
Copy link
Author

acaliaro commented Jul 4, 2024

@samhouts any news on this?

@kubaflo
Copy link
Contributor

kubaflo commented Jul 6, 2024

@acaliaro using Mode=OneWay like this for example IsVisible="{Binding IsBackButtonVisible, Mode=OneWay} accomplishes what you want :)

@samhouts
Copy link
Member

Looks like this fix is available in 9.0 preview 7! Thanks!!!

@github-actions github-actions bot locked and limited conversation to collaborators Sep 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-navigation NavigationPage fixed-in-9.0.0-preview.7.24407.4 platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants