UWP Webview 2 WebViewContainer.CoreWebView2.AddHostObjectToScript without C++ WinRT Component #3785
Unanswered
VishyBala007
asked this question in
Q&A
Replies: 1 comment
-
Hello, Also let me know is there any alternate (C# library) to using WinRT C++ adapter?? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a UWP application where I am using WebView 2 Controls to host the websites.
Now when I need to connect between Js and my C# code all are saying to use the WinRT C++ adapter wrapper.
var dispatchAdapter = new WinRTAdapter.DispatchAdapter(); WebViewContainer.CoreWebView2.AddHostObjectToScript("external", dispatchAdapter.WrapObject(App.MessageCallWrapper, dispatchAdapter));
Is it necessary to use the WinRT C++ adapter project in UWP, without that I get error every-time and using it I am able to access the C# class from JS script.
Thanks,
Vishy
Links: https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/winrt-from-js?tabs=winui2%2Cwinrtcsharp
Beta Was this translation helpful? Give feedback.
All reactions