Replies: 1 comment
-
|
Checking from source code, you could use the same validation? Routing.cs or |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
It would be cool to have the ability to check whether a certain route has already been registered.
In my scenario I am doing route registration automatically via a navigation service and extended
ContentPage.However, due to the current API and behavior of .NET MAUI, there is a scenario in which the code attempts to register the same route twice.
I don't really want to catch exceptions and check for string equality since it would also swallow developer's mistakes.
I'd rather have an API to check for a specific route whether it has already been registered or not before calling
Routing.RegisterRoute.Alternatively
Routing.RegisterRoutecould have a parameter to set whether it should throw on duplicate registration attempt or not.Public API Changes
or
Intended Use-Case
I am using
ShellwithFlyoutand want a specific page to be created on app startup.However, I have an extended
ContentPagewhere I am passing a ViewModel instance as constructor parameter to be able to automatically resolve it using theIServiceProviderduring Shell navigation.To still be able to pre-create the page during app startup, I am now setting the
BindingContextvia XAML and inOnBindingContextChangedregistering the route to the page.The
OnBindingContextChanged, however, does get called more than once and therefor can throw an exception on attempting to register the route.Beta Was this translation helpful? Give feedback.
All reactions