我想做同样的问题,但是对于.NET MAUI:Same header & footer in all WPF windows
所有窗口的页眉和页脚都是相同的。
发布于 2022-12-03 19:19:19
如果您不想点击评论中提供的链接@Jason,下面是一个简短的版本。
PageLayout.xaml文件:
<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文件:
public partial class PageLayout : ContentPage
{
public IList<IView> PageLayoutContent => PrimaryPageLayout.Children;
public PageLayout()
{
InitializeComponent();
}
}SubView.xaml文件:
<PageLayout ... >
<views:PageLayout.PageLayoutContent>
<!--Main content-->
</views:PageLayout.PageLayoutContent>
</PageLayout>https://stackoverflow.com/questions/74668855
复制相似问题