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

网站建设中常见的问题广州建筑集团有限公司品牌

网站建设中常见的问题,广州建筑集团有限公司品牌,网站再就业技能培训班,wordpress数据库损坏网站.NET多平台应用程序UI#xff08;. NET MAUI#xff09;的市场吸引力与日俱增#xff0c;这是微软最新的开发平台#xff0c;允许开发者使用单个代码库创建跨平台应用程序。尽管很多WPF开发人员还没有跟上 .NET MAUI的潮流#xff0c;但我们将在这篇文章中为大家展示他的潜….NET多平台应用程序UI. NET MAUI的市场吸引力与日俱增这是微软最新的开发平台允许开发者使用单个代码库创建跨平台应用程序。尽管很多WPF开发人员还没有跟上 .NET MAUI的潮流但我们将在这篇文章中为大家展示他的潜力具体来说想描述一下WPF和.NET MAUI之前的共性。 PSDevExpress WPF拥有120个控件和库将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpress WPF能创建有着强大互动功能的XAML基础应用程序这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。 DevExpress WPF 最新版下载(Q技术交流674691612 项目结构 与Xamarin不同.NET MAUI解决方案包含针对所有目标平台的单个项目。像WPF一样 .NET MAUI项目包含一个App.xaml文件和主视图另外可以发现AppShell类被用作根视觉元素 Resources文件夹包含跨每个平台使用的应用程序资源开发者可以将特定于平台的资源放在Platforms目录的子文件夹中以便在应用程序启动时执行相关代码。 XAML和代码隐藏 .NET MAUI页面具有与WPF窗口或用户控件相似的结构根元素包含命名空间声明和x:Class属性该属性定义了代码背后的类名 ?xml version1.0 encodingutf-8 ? ContentPage xmlnshttp://schemas.microsoft.com/dotnet/2021/maui xmlns:xhttp://schemas.microsoft.com/winfx/2009/xaml x:ClassMauiFirstApp.MainPage ScrollView !--...-- /ScrollView /ContentPage InitializeComponent方法是根据XAML自动生成的 namespace MauiFirstApp; public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); } } 绑定 .NET MAUI绑定使用与WPF绑定相似的上下文它有类似的模式、相对源、转换器等。.NET MAUI使用了与WPF的DataContext类似的概念唯一的区别是这个属性叫做BindingContext ContentPage xmlnshttp://schemas.microsoft.com/dotnet/2021/maui xmlns:xhttp://schemas.microsoft.com/winfx/2009/xaml xmlns:localclr-namespace:MauiFirstApp x:ClassMauiFirstApp.MainPage ContentPage.BindingContext local:ViewModel/ /ContentPage.BindingContext Label Text{Binding FirstName}/ /ContentPage 布局 .NET MAUI包含与Grid和StackPanel相似的东西可以帮助开发者根据业务需求安排可视化元素 Grid Grid.ColumnDefinitions ColumnDefinition WidthAuto/ ColumnDefinition Width*/ /Grid.ColumnDefinitions ListView Grid.Column0/ StackLayout Grid.Column1 WidthRequest50 Button TextPrint/ Button TextExport/ /StackLayout /Grid 资源 资源字典存储应用程序资源(样式、模板、转换器等)开发者可以使用StaticResource或DynamicResource标记扩展来将这些资源应用到元素上 ContentPage xmlnshttp://schemas.microsoft.com/dotnet/2021/maui xmlns:xhttp://schemas.microsoft.com/winfx/2009/xaml xmlns:localclr-namespace:MauiFirstApp x:ClassMauiFirstApp.MainPage ContentPage.Resources Color x:KeyButtonBackgroundColorDarkOrange/Color Color x:KeyButtonForegroundColorBlack/Color /ContentPage.ResourcesButton TextExport BackgroundColor{StaticResource ButtonBackgroundColor} TextColor{StaticResource ButtonForegroundColor}/ /ContentPage 模板 在.NET MAUI中您可以使用 ControlTemplates 和DataTemplates来保持与WPF相同的UI灵活性 ListView ListView.ItemTemplate DataTemplate Label Text{Binding FirstName}/ /DataTemplate /ListView.ItemTemplate /ListView 样式 开发者可以创建显式和隐式样式来将类似的设置应用于多个元素 ContentPage.Resources Style TargetTypeButton Setter PropertyBackground ValueOrange/ Setter PropertyTextColor ValueWhite/ Setter PropertyCornerRadius Value4/ /Style /ContentPage.Resources StackLayout OrientationHorizontal Button TextNext/ Button TextPrev/ /StackLayout 触发器 声明式XAML触发器允许开发者有条件地应用样式 ContentPage.Resources Style TargetTypeEditor x:KeyredOnFocusStyle Style.Triggers Trigger TargetTypeEditor PropertyIsFocused ValueTrue Setter PropertyBackground ValueRed/ /Trigger /Style.Triggers /Style /ContentPage.Resources StackLayout VerticalOptionsStart Editor TextRed on Focus Style{StaticResource redOnFocusStyle}/ /StackLayout 可视化树 与WPF非常相似可视元素的层次结构允许开发者轻松地识别控件的父元素和子元素Parent属性包含直接可视父属性和Children属性——直接子属性主要区别在于.NET MAUI没有逻辑树。 MVVM .NET MAUI使用与WPF相同的MVVM范例许多MVVM框架(如Prism)都是跨平台的因此您不太可能注意到许多差异。下面是一个基本的例子演示了如何在视图模型中将编辑器绑定到属性将按钮绑定到命令 ?xml version1.0 encodingutf-8 ? ContentPage xmlnshttp://schemas.microsoft.com/dotnet/2021/maui xmlns:xhttp://schemas.microsoft.com/winfx/2009/xaml xmlns:localclr-namespace:MauiFirstApp x:ClassMauiFirstApp.MainPage ContentPage.BindingContext local:ViewModel/ /ContentPage.BindingContext StackLayout VerticalOptionsStart Editor Text{Binding FirstName}/ Button TextProcess Command{Binding ProcessUserCommand}/ /StackLayout /ContentPage public class ViewModel : INotifyPropertyChanged { private string name; public string FirstName { get { return name; } set { name value; OnPropertyChanged(); } }public ICommand ProcessUserCommand { get; }public ViewModel() { ProcessUserCommand new Command(ProcessUser); }void ProcessUser() { Console.WriteLine(FirstName); }public event PropertyChangedEventHandler PropertyChanged;public void OnPropertyChanged([CallerMemberName] string name ) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } 依赖项属性 .NET MAUI 依赖属性称为可绑定属性它们使用类似的声明结构一个静态字段和一个公共属性。BindableProperty.Create方法接受所有与DependencyProperty.Register类似的参数在WPF中注册 public int MaxValue { get (int)GetValue(MaxValueProperty); set SetValue(MaxValueProperty, value); }public static readonly BindableProperty MaxValueProperty BindableProperty.Create(MaxValue, typeof(int), typeof(MainPage), 0, propertyChanged: OnMaxValueChanged);private static void OnMaxValueChanged(BindableObject bindable, object oldValue, object newValue) { // ... } 结论 WPF和.NET MAUI开发有许多共同之处如果您熟悉WPF可以毫不费力地创建一个功能强大的.NET MAUI应用程序。
http://www.hkea.cn/news/14418020/

相关文章:

  • 3d房子模型设计软件珠海seo推广
  • jquery代码做的网站做存储各种环境信息的网站
  • 柬埔寨网站开发聊城网站建设电话
  • 高端建站方案签订网站制作合同注意事项
  • 淘客做自己的网站厦门网站综合优化贵吗
  • 文山文山市网站建设中国建设银行网站忘记密码
  • 做视频资源网站有哪些难点安徽省建设部网站
  • 做demo的网站手机微信网页版网址
  • dedecms织梦搬家公司网站模板网站用户量
  • 东莞南城网站建设价格网页版qq音乐
  • 网站开发要怎么学网站建设中标签导航的特征
  • 学校网站官网佛山市seo推广
  • 门户网站建设费公司页面设计图片
  • 简约好看的网站模板免费下载个人网站怎样备案
  • 深圳模板网站制作电子商务网站有哪些和网址
  • 电商网站建设行情打开qq邮箱进入wordpress
  • 如何压缩网站手机中国官网
  • 电商网站 解决方案做积分商城网站
  • 网站转微信小程序海南网站建设报价方案
  • 做的好的网站营销微信公众号创新创业网站建设
  • 网站界面用什么做的微博营销的定义
  • 简单的网站建设步骤番禺做网站800元
  • 制作网站的花多少钱四川手机网站有哪些
  • 罗定建设局网站成都网页设计师
  • 濮阳网站建设网站网络舆情监测服务
  • 网站怎么做定时任务宿迁网站建设价格低
  • 如何用网页设计制作个人网站开发公司给物业公司开办费
  • 网站建设行业查看网站dns服务器
  • 网站建设与管理期末下载软件的网站
  • 怎么用电脑做网站小程序做网站登录