dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.17k stars 1.74k forks source link

[Spec] Add better parameters for navigation args #21814

Open PureWeen opened 6 months ago

PureWeen commented 6 months ago

Description

Currently the navigation args provide no useful information:

We added these args very early on so that we'd be setup to add better information later on.

Here are some suggested additional properties

ederbond commented 3 months ago

Any News around this one @PureWeen ? This is the main show stopper for me to adopt shell?

ederbond commented 2 months ago

Any news around this?

ederbond commented 2 months ago

It has been +2 years since I've reported this bug for MSFT and they didn't come up with a proper solution, so to save your precious time consider completely ditching MAUI AppShell for now, and use the following library to workaround this issue: https://github.com/naveasy/Naveasy

FabriBertani commented 2 months ago

Any news on this @PureWeen @jfversluis @samhouts ?

ederbond commented 2 months ago

.NET 9 is just around the corner and I have serious doubt if they are gonna release it despite of asking for it since early days of .NET 6 many years ago with a bunch of details, samples and etc as you can see on the following Issue (which they shamelessly closed without any solution when it reached 2yo and reached the 1st most commented issue here on MAUI GH repo, instead of keeping it open until this api design flaw gets fixed).

https://github.com/dotnet/maui/issues/7354

gwise-vision commented 1 month ago

In the OnNavigatedTo event of Page, PreviousPage of NavigatedToEventArgs is declared as internal, so it cannot be used.

Is there a reason why you declared PreviousPage as internal? I want PreviousPage to be declared as public.

namespace Microsoft.Maui.Controls { public sealed class NavigatedToEventArgs : EventArgs { internal NavigatedToEventArgs(Page previousPage) { PreviousPage = previousPage; }

internal Page PreviousPage { get; }  <-- Why internal?

} }

MagicAndre1981 commented 1 month ago

In the OnNavigatedTo event of Page, PreviousPage of NavigatedToEventArgs is declared as internal, so it cannot be used.

Is there a reason why you declared PreviousPage as internal? I want PreviousPage to be declared as public.

create a new PR for it. There was one, which was closed to no activity from the author.

gwise-vision commented 1 month ago

See How to use PreviousPage which is hidden internally.

https://github.com/dotnet/maui/pull/21754

ederbond commented 1 month ago

@PureWeen we're eager waiting for this to see the light of the day so I can finally starts using Shell.

gwise-vision commented 1 month ago

@PureWeen we're eager waiting for this to see the light of the day so I can finally starts using Shell. In addition to the suggested properties described on this issue description it would be nice if you could provide us a way to cancel/override back button navigation. It could be a bool property where we can set to cancel navigation or a brand new event that's triggered right when the user clicked on the phisical device back button but before the back navigation really takes place. This might be out of scope, but if easy to implemente it would be nice to have.

Here's a sample that asks the user to save the modified data before going back when the user edits the data on the Page screen. image

ederbond commented 1 month ago

@gwise-vision thanks for the example, I haven't played too much with shell because of the original reason of this bug item. But your as by your sample it seems nice the way Maui AppShell allows us to achieve this back navigation confirmation scenario. Thanks for sharing.

ederbond commented 3 weeks ago

Is it still planed for .NET 9 GA or are we going to have to wait for another entire year until .NET 10? @PureWeen @jfversluis @samhouts @davidortinau @StephaneDelcroix