Search code examples
.netxamarinmaui

.NET MAUI - Split View AppShell / Static Map Layout


I'm building an app in .NET MAUI that currently uses AppShell for navigation and works well when used with a phone or tablet both locked to portait mode. There is a new requirement coming that will allow the user to use the same app on a tablet in landscape mode which will then present a split screen view. On the left would be the application running exactly how it does currently using AppShell and on the right would a static map control. The user should be able to navigate through the app on the left side normally while the right side remains unchanged. Is there a way I can achieve this goal and still take advantage of AppShell navigation? Or am I going to need to switch to NavigationPages? Or is this even possible?

I've tried creating a tablet-specific AppShell file that loads if the device is of the tablet idiom. It defines a singular ShellContent where the split screen is defined. I am overriding navigation in the AppShell codebehind to essentially transplant page content to the ContentView defined in the ShellContent and that sorta works however I lose benefits of AppShell for back navigation. Am I on the right track here? Any other suggestions that might work in the AppShell vein? Or maybe rethink it using NavigationPages or something else? I am aware of the TwoPaneView in MAUI but I'm not sure if this is going to help me achieve my goal.

Thanks in advance for any suggestions you might have.


Solution

  • I have found a suitable solution for this that involves intercepting normal AppShell navigation to transplant the content of new ContentPages into predefined ContentViews within a singular ShellContent. I have to manually manage a page stack since I cannot rely on AppShell.

    I have a test project on my github showing how I did everything: https://github.com/timdog/AppShellSplitScreen