Setting up navigation without .NET MAUI Shell
As I mentioned earlier, Shell is an opinionated way to create the structure of a .NET MAUI app. This might not work for you or your particular project. Not using Shell complicates the implementation of a NavigationService
a lot, especially when your app has a complex structure such as tabs or a flyout menu. Let’s focus on a simple hierarchical navigation and see what is needed to implement a NavigationService
without relying on another framework.
Luckily, the interfaces we created earlier (INavigationService
, INavigatedTo
, INavigatedFrom
, and INavigationParameterReceiver
) are framework-independent and can still be used as the backbone of this implementation:
- No Shell means no routing. However, I do like the concept of having keys associated with a particular view as it allows for a loosely coupled way of navigating. That’s why we’re creating a static
Routes
class in theNavigation
folder of theRecipes.Mobile...