xamarin platform.getRenderer(视图)已过时

eit6fx6z  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(173)

所以我在两个平台(iOS和Android)中都使用了这个兼容性渲染器,它有这个方法Platform.GetRenderer(view),但是在Maui的RC版本中,这个方法似乎已经被标记为过时了,有人知道这个新方法是什么吗?

var nativeView = Microsoft.Maui.Controls.Compatibility.Platform.iOS.
            Platform.GetRenderer(view)?.NativeView;

var nativeView = Microsoft.Maui.Controls.Compatibility.Platform.Android.
            Platform.GetRenderer(view)?.NativeView;

先谢了

tvokkenx

tvokkenx1#

如果我找到了正确的pull request,它们就会被废弃,因为:
目前,我们有一个Handler版本的Xamarin.Forms中的所有传统渲染器,因此用户将获得最大的成功,只是使用Handlers与使用Renderers
基于过时的消息,您应该改用Use Microsoft.Maui.Controls.Handlers.Compatibility.VisualElementRenderer

相关问题