我想做的和这个问题一样,但是对于.NET MAUI:Same header & footer in all WPF windows所有窗口页眉和页脚都相同
qrjkbowd1#
如果你不想点击评论中提供的链接@杰森,这里有一个简短的版本。页面布局.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>
页面布局.xaml.cs文件:
public partial class PageLayout : ContentPage { public IList<IView> PageLayoutContent => PrimaryPageLayout.Children; public PageLayout() { InitializeComponent(); } }
子视图.xaml文件:
<PageLayout ... > <views:PageLayout.PageLayoutContent> <!--Main content--> </views:PageLayout.PageLayoutContent> </PageLayout>
1条答案
按热度按时间qrjkbowd1#
如果你不想点击评论中提供的链接@杰森,这里有一个简短的版本。
页面布局.xaml文件:
页面布局.xaml.cs文件:
子视图.xaml文件: