Shell
This page describes how create a Shell in MauiReactor
.NET Multi-platform App UI (.NET MAUI) Shell reduces the complexity of app development by providing the fundamental features that most apps require, including:
A single place to describe the visual hierarchy of an app.
A common navigation user experience.
A URI-based navigation scheme that permits navigation to any page in the app.
An integrated search handler.
Official documentation: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/ MauiReactor sample app: https://github.com/adospace/mauireactor-samples/tree/main/Controls/ShellTestPage https://github.com/adospace/mauireactor-samples/tree/main/Controls/ShellNavTestPage
Shell with ShellContents
The sample code below shows how to create a Shell with some pages using the ShellContent class:
class MainPageState
{
public int Counter { get; set; }
}
class MainPage : Component<MainPageState>
{
public override VisualNode Render()
=> new Shell
{
new ShellContent("Home")
.Icon("home.png")
.RenderContent(()=> new HomePage()),
new ShellContent("Comments")
.Icon("comments.png")
.RenderContent(()=> new CommentsPage()),
};
}
class HomePage : Component
{
public override VisualNode Render()
{
return new ContentPage("Home")
{
new Label("Home")
.VCenter()
.HCenter()
};
}
}
class CommentsPage : Component
{
public override VisualNode Render()
{
return new ContentPage("Comments")
{
new Label("Comments")
.VCenter()
.HCenter()
};
}
}


Shell with Tab and FlyoutItem (AsMultipleItems)
Following it's another sample of Shell with more items arranged inside a FlyoutItem and Tab:


Custom FlyoutItem appearance
In the following code, FlyoutItems appearance is customized:

Custom FlyoutContent
You can also provide custom content for the Flyout as shown below:

Shell menu items
You can also create a simple menu item inside the shell with a custom command:

In the following sample code, we're going to customize the MenuItems:

Flyout Header and Footer
You can customize the flyout header and footer as well:
This is the resulting effect:

Tabs
You can create Tabs on top and bottom; just nest shell contents within Tab and TabBar objects as shown in the below example:

You can also change tab bar properties like the background color or select a specific tab. The following code shows how to:

Navigation
.NET Multi-platform App UI (.NET MAUI) Shell includes a URI-based navigation experience that uses routes to navigate to any page in the app, without having to follow a set navigation hierarchy. In addition, it also provides the ability to navigate backwards without having to visit all of the pages on the navigation stack.
MauiReactor allows the registration of components with routes just like you do with Page in normal Maui applications.
To register a route you have to use the Routing.RegisterRoute<Component>("page name") method.
The following example shows how to register a few routes and how to navigate to them:

Passing arguments to pages (components) would mean creating a Props class for the target page and using an overload of the GotoToAsync as shown below:

Shell TitleView
Shell control enables any View to be displayed in the navigation bar using the TitleView. In MauiReactor, you can set up a custom view using the TitleView fluent method of the ContentPage.
ContentPage must be installed inside a Shell to enable the TitleView
Last updated
Was this helpful?