.NET MAUI进行UDP通信(二)

时间:2025-01-27 11:56:05
<?xml version="1.0" encoding="UTF-8" ?> <Shell x:Class="mauiDemo.AppShell" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:mauiDemo" xmlns:minePage ="clr-namespace:mauiDemo.Page" Shell.FlyoutBehavior="Disabled" Title="mauiDemo"> <!--<ShellContent Title="Home" ContentTemplate="{DataTemplate local:MainPage}" Route="MainPage" />--> <TabBar> <ShellContent Title="Home" ContentTemplate="{DataTemplate minePage:Mine}" Route="Page/Mine"> <!--<ContentPage> <StackLayout> <Label Text="Welcome to the Home Page" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" /> </StackLayout> </ContentPage>--> </ShellContent> <ShellContent Title="Search"> <ContentPage> <StackLayout> <Label Text="Search Page" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" /> </StackLayout> </ContentPage> </ShellContent> <ShellContent Title="Settings"> <ContentPage> <StackLayout> <Label Text="Settings Page" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" /> </StackLayout> </ContentPage> </ShellContent> </TabBar> 1).将MainPage注释掉 2).添加tabbar功能 3).第一个ShellConten的路由设置为Mine文件,注意到ContentTemplate="{DataTemplate minePage:Mine}",当前不是local,是因为我们引用了命名空间并命名为minePage: xmlns:minePage ="clr-namespace:mauiDemo.Page". 路由 Route="Page/Mine" 可结合上篇文章了解,在下面会贴出完整项目结构图 </Shell>