I'm using Xamarin Forms 4.4.0.991640
I thought I'd give shell a chance and built my new project using it. Unsurprisingly, I run into myriads of issues, how very typical of Xamarin.
The BackButtonBehavior deserves a special mention because the issues surrounding it are just so blatantly obvious yet overlooked by Xamarin team.
So BackButtonBehavior meant to be used like this.Shell.SetBackButtonBehavior(this, new BackButtonBehavior { TextOverride = "Go Back", IconOverride = ImageSource.FromFile("back.png"), Command = new Command(() => { Navigation.PopAsync(true); }) });
What I wanted initially was to have no text, so I tried this:Shell.SetBackButtonBehavior(this, new BackButtonBehavior { TextOverride = string.Empty });
Made absolutely no difference.
Then I tried:Shell.SetBackButtonBehavior(this, new BackButtonBehavior { TextOverride = "Go Back" });
Ok... So the text has changed, but the back icon's gone.
So I create my own png back icon and try this:Shell.SetBackButtonBehavior(this, new BackButtonBehavior { TextOverride = "Go Back", IconOverride = ImageSource.FromFile("back.png") });
Boom! Icon is replaced but there's no text.
Then when I press back, it takes me to the previous page but half of the screen is white...
I use my googlefu to try and find a solution. I run into this:
github.com/xamarin/Xamarin.Forms/issues/4845
The issue is closed because apparently it's been 'revolved'. Basically, unless you added a Command, it used to crash. Well, it doesn't crash anymore, but having half of the screen going white isn't any better. So I'm forced to add the command to get around the issue like so:Shell.SetBackButtonBehavior(this, new BackButtonBehavior { TextOverride = "Go Back", IconOverride = ImageSource.FromFile("back.png"), Command = new Command(() => { Navigation.PopAsync(true); }) });
Am I doing something wrong? If not, why are there so many blatantly obvious issues? Back in the days, the excuse used to be "Xamarin Forms is still new framework. Give it some time. etc etc". Well, it ain't so new now. I'm seriously considering Flutter or native, despite being an experienced .Net developer.