I wanted to do the same as this question, but for .NET MAUI: Same header & footer in all WPF windows
It is same header and footer for all windows.
I found a better way to do it using control templates.
PageLayout.xaml file:
<ContentPage ...>
<ContentPage.Resources>
<ControlTemplate x:Key="PageLayoutTemplate">
<Grid RowDefinitions="Auto,*,Auto">
<!--Header-->
<Grid>
<!--header content-->
</Grid>
<!--Content-->
<ContentPresenter Grid.Row="1"/>
<!--Footer-->
<Grid Grid.Row="2">
<!--footer content-->
</Grid>
</Grid>
</ControlTemplate>
</ContentPage.Resources>
</ContentPage>
SubView.xaml file:
<PageLayout ...
ControlTemplate="{StaticResource PageLayoutTemplate}">
<Grid>
<!--Main content-->
</Grid>
</PageLayout>
Why this is better:
Reference: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/controltemplate?view=net-maui-7.0