适用于初学者的 .NET MAUI - xaml 用于添加列表中的内容
适用于初学者的 .NET MAUI | Microsoft Learn
记录微软Learn中用到的代码。文章比较粗糙,大部分是项目代码粘贴。想详细学习的可到上面的链接学习,代码可以从这里复制后直接运行。
练习中一共有两个页面:
1、MainPage.xaml 用于添加列表中的内容。主要功能有向列表中添加一项;左滑删除该项;点击该选项进入详情页面。
2、DetailPage.xaml 显示详细信息,实际上显示的很少。返回主界面。
用到的MVVM包有: 拼多多帮助力入口
1、CommunityToolkit.Mvvm
接下来是MainPage.xaml代码:
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiAppDemo1.MainPage"
xmlns:viewmode="clr-namespace:MauiAppDemo1.ViewModel"
x:DataType="viewmode:MainViewModel">
ColumnDefinitions=".75*,.25*"
Padding="10"
RowSpacing="10"
ColumnSpacing="10">
Source="dotnet_bot.png"
Background="white"/>
Text="{Binding Text}"
Grid.Row="1"/>