当前位置: 首页 > news >正文

政务网站建设实施方案导购网站怎么做视频教学

政务网站建设实施方案,导购网站怎么做视频教学,无锡企业做网站,做网站怎么样才能排在首页适用于初学者的 .NET MAUI | Microsoft Learn 记录微软Learn中用到的代码。文章比较粗糙#xff0c;大部分是项目代码粘贴。想详细学习的可到上面的链接学习#xff0c;代码可以从这里复制后直接运行。 练习中一共有两个页面#xff1a; 1、MainPage.xaml 用于添加列表中的… 适用于初学者的 .NET MAUI | Microsoft Learn 记录微软Learn中用到的代码。文章比较粗糙大部分是项目代码粘贴。想详细学习的可到上面的链接学习代码可以从这里复制后直接运行。 练习中一共有两个页面 1、MainPage.xaml 用于添加列表中的内容。主要功能有向列表中添加一项左滑删除该项点击该选项进入详情页面。 2、DetailPage.xaml 显示详细信息实际上显示的很少。返回主界面。 用到的MVVM包有 1、CommunityToolkit.Mvvm 接下来是MainPage.xaml代码 ?xml version1.0 encodingutf-8 ? ContentPage xmlnshttp://schemas.microsoft.com/dotnet/2021/mauixmlns:xhttp://schemas.microsoft.com/winfx/2009/xamlx:ClassMauiAppDemo1.MainPagexmlns:viewmodeclr-namespace:MauiAppDemo1.ViewModelx:DataTypeviewmode:MainViewModelGrid RowDefinitions100,Auto,*ColumnDefinitions.75*,.25*Padding10RowSpacing10ColumnSpacing10Image Grid.ColumnSpan2Sourcedotnet_bot.pngBackgroundwhite/Entry PlaceholderEnter taskText{Binding Text}Grid.Row1/Button TextAddCommand{Binding AddCommand}Grid.Row1Grid.Column1/CollectionView Grid.Row2 Grid.ColumnSpan2ItemsSource{Binding Items}SelectionModeNone!--CollectionView.ItemsSourcex:Array Type{x:Type x:String}x:StringApples/x:Stringx:StringBananas/x:Stringx:StringOranges/x:String/x:Array/CollectionView.ItemsSource--CollectionView.ItemTemplateDataTemplate x:DataType{x:Type x:String}SwipeViewSwipeView.RightItemsSwipeItems SwipeItem TextDeleteBackgroundColorRedCommand{Binding Source{RelativeSource AncestorType{x:Type viewmode:MainViewModel}},PathDeleteCommand}CommandParameter{Binding .}//SwipeItems/SwipeView.RightItemsGrid Padding0,5FrameFrame.GestureRecognizersTapGestureRecognizer Command{Binding Source{RelativeSource AncestorType{x:Type viewmode:MainViewModel}},PathTapCommand}CommandParameter{Binding .}//Frame.GestureRecognizersLabel Text{Binding .}FontSize24//Frame/Grid/SwipeView/DataTemplate/CollectionView.ItemTemplate/CollectionView/Grid/ContentPageusing MauiAppDemo1.ViewModel;namespace MauiAppDemo1;public partial class MainPage : ContentPage {int count 0;public MainPage(MainViewModel vm){InitializeComponent();BindingContext vm;}} using MauiAppDemo1.ViewModel;namespace MauiAppDemo1;public static class MauiProgram {public static MauiApp CreateMauiApp(){var builder MauiApp.CreateBuilder();builder.UseMauiAppApp().ConfigureFonts(fonts {fonts.AddFont(OpenSans-Regular.ttf, OpenSansRegular);fonts.AddFont(OpenSans-Semibold.ttf, OpenSansSemibold);});builder.Services.AddSingletonMainPage();builder.Services.AddSingletonMainViewModel();builder.Services.AddTransientDetailPage();builder.Services.AddSingletonDetailViewModel(); return builder.Build();} }namespace MauiAppDemo1;public partial class AppShell : Shell {public AppShell(){InitializeComponent();Routing.RegisterRoute(nameof(DetailPage),typeof(DetailPage));} }using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks;namespace MauiAppDemo1.ViewModel {/// summary/// CommunityToolkit.Mvvm/// /summarypublic partial class MainViewModel : ObservableObject{public MainViewModel(){items new ObservableCollectionstring();}[ObservableProperty]ObservableCollectionstring items;[ObservableProperty]string text;[RelayCommand]void Add(){if (string.IsNullOrWhiteSpace(Text)) return;items.Add(Text);Text string.Empty;}[RelayCommand]void Delete(string s){if (items.Contains(s)){items.Remove(s);}}[RelayCommand] async Task Tap(string s){await Shell.Current.GoToAsync(${nameof(DetailPage)}?Text{s});}}/// summary/// 基本写法/// /summary//public class MainViewModel : INotifyPropertyChanged//{// string text;// public string Text// {// get text;// set// {// textvalue;// OnPropertyChanged(nameof(Text));// }// }// public event PropertyChangedEventHandler PropertyChanged;// void OnPropertyChanged(string name)PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));//} }DetailPage.xaml ?xml version1.0 encodingutf-8 ? ContentPage xmlnshttp://schemas.microsoft.com/dotnet/2021/mauixmlns:xhttp://schemas.microsoft.com/winfx/2009/xamlx:ClassMauiAppDemo1.DetailPagexmlns:viewmodelclr-namespace:MauiAppDemo1.ViewModelx:DataTypeviewmodel:DetailViewModelTitleDetailPageVerticalStackLayout Padding20Label Text{Binding Text}FontSize25VerticalOptionsCenter HorizontalOptionsCenter /Button TextGo BackCommand{Binding GoBackCommand}//VerticalStackLayout /ContentPage using MauiAppDemo1.ViewModel;namespace MauiAppDemo1;public partial class DetailPage : ContentPage {public DetailPage(DetailViewModel vm){InitializeComponent();BindingContext vm;} } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input;namespace MauiAppDemo1.ViewModel {[QueryProperty(Text,Text)]public partial class DetailViewModel:ObservableObject{[ObservableProperty]string text;[RelayCommand]async Task GoBack(){await Shell.Current.GoToAsync(..);}} }
http://www.sczhlp.com/news/184423/

相关文章:

  • 中国电力建设集团网站网站架构图一般包括什么
  • es网站建设建设网站要不要钱百度贴吧
  • 巴彦淖尔市 网站建设网站建站商城
  • 做一借款撮合网站销售推广
  • WordPress5分钟建站项目报价单模板
  • 镇平微网站建设徐州哪里做网站
  • 盐城网站制作网络推广做区块链网站的公司
  • 怎么在ftp看网站后台地址用什么软件建网站最方便
  • 美丽乡村建设网站模板长沙网站外包
  • 全运会为什么建设网站建筑行业官方网站
  • 毕业设计做网站 如何做做那种类型的网站seo好
  • 绍兴专业网站建设公司wordpress 多米 主题
  • dw怎么做网站注册登入页面网站搭建联系方式
  • 重生之我是特莉丝
  • HTML5-标签语法
  • 金蝶KIS云.标准版v14.0破解补丁(20211201)
  • 高QE sCMOS相机在SIM超分辨显微成像中的应用 - 详解
  • 基本骨架
  • 网站建设中端口号的作用是什么意思环球网站建设
  • 个体工商户做的网站能推广吗wordpress写 a href
  • 电力网站建设网站定制要求
  • 网站策划书背景介绍建设网站的相关技术指标
  • 东莞易宣网站建设公司怎么样网站托管流程
  • 服务器网站怎么做中国建站网
  • 使用vue做商城网站项目难点岳阳建设厅网站
  • 上海注册公司地址费用深度优化
  • 做网站需要什么软件教程关于字体设计的网站
  • 石柱县建设局网站怎么做网站的快照
  • 小型网站有哪些时尚网站设计案例
  • wordpress问答站模板源码论坛网搭建