question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] Shell BackButtonBehavior binding Command to valid ICommand causes back button to disappear

See original GitHub issue

Description

Binding to a valid ICommand on Shell.BackButtonBehavior causes back button to disappear on Android (maybe iOS as well, no idea on Windows since it is not currently supported).

Steps to Reproduce

  1. File -> New .NET MAUI App
  2. Create multi-page Shell App
  3. On SecondPage create BackButtonBehavior and bind Command to a valid ICommand on the BindingContext:
 <Shell.BackButtonBehavior>
      <BackButtonBehavior
          Command="{Binding BackCommand}"
          IsEnabled="True"
          IsVisible="True">
          <BackButtonBehavior.IconOverride>
              <FontImageSource FontFamily="OpenSansSemibold" Glyph="&#x2039;" />
          </BackButtonBehavior.IconOverride>
      </BackButtonBehavior>
  </Shell.BackButtonBehavior>
  1. Run the app and navigate to SecondPage
  2. Observe back button is not visible
  3. While app is still running, use Hot Reload to change the BackButtonBehavior Command binding to invalid ICommand and observe the back button appears but does nothing since binding is invalid

RC3 reproduction repo can be found here: https://github.com/rjygraham/MauiShellNav

Reproduction video can be found here: https://raw.githubusercontent.com/rjygraham/MauiShellNav/main/videos/BackButtonBehavior.mp4

Version with bug

Release Candidate 3 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android 11

Did you find any workaround?

None yet

Relevant log output

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
espenrlcommented, Dec 16, 2022

The same happens on .NET 7 SR 1.

0reactions
Zhanglirong-Winniecommented, Aug 2, 2023

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 5.0. Can repro on android platform with sample project. MauiShellNav-main.zip 7045

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding Back Button in Xamarin.Forms Shell…
I've been working on trying to override the back button behavior on Xamairn.Forms Shell recently, both with Navigation bar button and Android ......
Read more >
Shell BackButtonBehavior command binding not working ...
When I pressed the back button, the method "GoBackButton" didn't call. I want to mention that on Android works. xamarin · xamarin.forms ·...
Read more >
Now that I have shell (working?) it does not respond to the ...
I put in the following code but a back button is not visible on the view that shows the hotdog icon so it...
Read more >
Xamarin Forms, the MVVMLight Toolkit and I: taking control ...
In this post of my ongoing series about using MVVMLight with Xamarin Forms, I am going to show you an easy way to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found