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.
CodePudding user response:
If you don't want to click the link @Jason provided in the comment, here is a shortened version.
PageLayout.xaml file:
<ContentPage ...>
<Grid RowDefinitions="Auto,*,Auto">
<!--Row 1 : Header-->
<Grid>
<!--header content-->
</Grid>
<!--Row 2 : Content-->
<Grid Grid.Row="1"
Name="PrimaryPageLayout">
</Grid>
<!--Row 3 : Footer-->
<Grid Grid.Row="2">
<!--footer content-->
</Grid>
</Grid>
</ContentPage>
PageLayout.xaml.cs file :
public partial class PageLayout : ContentPage
{
public IList<IView> PageLayoutContent => PrimaryPageLayout.Children;
public PageLayout()
{
InitializeComponent();
}
}
SubView.xaml file:
<PageLayout ... >
<views:PageLayout.PageLayoutContent>
<!--Main content-->
</views:PageLayout.PageLayoutContent>
</PageLayout>