WebViewRenderer is deprecated from .NET MAUI; Doesn't suggest alternative

Daniel Chang 21 Reputation points
2022-08-03T04:49:41.147+00:00

I'm migrating Xamarin project to MAUI and migrated most of my code. However, Microsoft.Maui.Controls.Compatibility.Platform.Android.WebViewRenderer is giving a warning that it's deprecated with the following message: 'WebViewRenderer' is obsolete: This renderer is obsolete please try to use the corresponding handler/mapper.

I'm not sure what it means to "use the corresponding handler/mapper", and it doesn't provide alternate solution for it. Can anyone suggest what is the best way to replace Microsoft.Maui.Controls.Compatibility.Platform.Android.WebViewRenderer?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,977 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 69,386 Reputation points Microsoft Vendor
    2022-08-03T07:23:05.927+00:00

    Hello,​

    I'm not sure what it means to "use the corresponding handler/mapper", and it doesn't provide alternate solution for it. Can anyone suggest what is the best way to replace

    You can use WebViewHandler instead of WebViewRenderer.

    With Handlers, the relationship between the framework and the platform is now inverted; the platform control only needs to handle the needs of the framework. Not only is this more efficient, but it is much easier to extend or override when needed. Gone are the days of needing to create Custom Renderers or Effects. The new architecture also makes the platform handlers much more suitable for reuse by other frameworks such as Fabulous, and experiments like Comet.

    Here are a document about using handler.

    See

    Customize .NET MAUI controls with handlers
    Porting Custom Renderers to Handlers

    If you can still use Custom Renderers in .NET MAUI.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful