尽管MAUI中使用了新的渲染模式, 但是仍然Xamarin中的支持Render渲染器, 这意味着如果你的项目是从Xamarin移植到MAUI当中, 大部分代码能够可以重用, 本篇文章介绍如何将Xamarin...Xamarin.Forms项目, 在Android项目中创建CustomRender文件夹, 并且创建自定义渲染器MyButtonRender, 如下所示:
说明: MyButtonRender类完整代码如下所示..., 接下来, 主要的任务是将Xamarin现有的
自定义渲染器移植到MAUI项目中, 那么下面接着继续表演。...引用:
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
添加新的MAUI引用:
using Microsoft.Maui.Controls...), typeof(MyButtonRender))] 声明,
在Xamarin当中, 渲染器强制声明在Android项目中, 耦合性很强。