liveBook · Manning

ShellContent

As explained in .NET MAUI in Action

ShellContent is a .NET MAUI Shell element that associates a navigable Shell item with page content.

ShellContent is the Shell element that connects a navigable Shell item to page content. Its Title labels the page, ContentTemplate supplies the page, and Route provides a navigation name. section 7.5.3

Assign a ContentPage through a DataTemplate so the page loads only when navigated to. This can reduce startup overhead when pages have many dependencies. section 7.5.3

Tabs for an inventory app

Place ShellContent inside Tab elements to expose pages as tabs: <Tab Title="Input"><ShellContent ContentTemplate="{DataTemplate pages:InputPage}" /></Tab>. A Reports tab can reference ReportPage in the same way. section 7.5.3

Listing 7.9 AppShell.xaml
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="MauiStockTake.Maui.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:pages="clr-namespace:MauiStockTake.Maui.Pages"
    xmlns:local="clr-namespace:MauiStockTake.Maui">
 
    <TabBar>
        <Tab Title="Input"                    #1
             Icon="icon_input.svg">           #2
            <ShellContent ContentTemplate="{
DataTemplate pages:InputPage}" />           #3
        </Tab>
        <Tab Title="Reports"
             Icon="icon_report.svg">
            <ShellContent ContentTemplate="{DataTemplate pages:ReportPage}" />
        </Tab>
    </TabBar>
 
</Shell>

Inspect the complete AppShell.xaml example, including InputPage and ReportPage ShellContent declarations inside a TabBar. section 7.5.3

How .NET MAUI in Action covers it

How deep it goes
Explains Title, ContentTemplate, and Route with deferred loading, but does not descend into navigation internals.
Examples
Uses MainPage, InputPage, and ReportPage declarations in default Shell and MauiStockTake tab configurations.
What it assumes
Assumes basic XAML and ContentPage familiarity while introducing Shell-based page hierarchy and navigation.
What you can do after
Build it from scratch by registering ContentPage instances, titles, templates, routes, and tab placement in AppShell.xaml.
How it connects
Connects ShellContent with Shell, ContentPage, DataTemplate, routes, tabs, and Shell navigation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET MAUI in Action. The section links point to the parts of the book it draws on.