Adopt possibility to resolve navigation Pages by type
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
Currently, the framework requires instantiation of a `ContentPage` object in order to navigate. This is quite obstructive when using constructor injection, especially when using MVU or lightweight patterns relying mostly on logic inside the code-behind.
This has been addressed in [this](https://github.com/dotnet/maui/discussions/1237) discussion and @matt-goldman actually provided a very lightweight and straightforward [solution ](https://github.com/matt-goldman/Maui.Plugins.PageResolver).
I suggest considering on adopting it into the framework's existing `Navigation`.
Blazor fell back to property injection which might not be ideal but at least provided a feasible solution.
### Public API Changes
Check the repository's README for reference.
### Intended Use-Case
Currently:
`await Navigation.PushModalAsync(new MyPage(/*requires dependencies*/));`
Goldman's solution:
`await Navigation.PushModalAsync(); // built-in container resolves dependencies`
Contributor guide
Research direction
Start by reviewing the repository README and the existing Navigation API, then compare the proposed usage with the linked Maui.Plugins.PageResolver solution and discussion. Done means the framework has an agreed, documented approach for calling PushModalAsync() while resolving the page's dependencies through the built-in container.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100