WebView2Samples icon indicating copy to clipboard operation
WebView2Samples copied to clipboard

C# Samples

Open yannduran opened this issue 6 years ago • 16 comments

Could you please provide samples in C#, not just C++? I can't make use of C++ project as I (and no doubt MANY others) develop solely in C#.

Thanks!

yannduran avatar Aug 18 '19 03:08 yannduran

Thanks, yes. We're looking into .NET support. We've got an issue open on our WebViewFeedback project. https://github.com/MicrosoftEdge/WebViewFeedback/issues/23

david-risney avatar Sep 04 '19 20:09 david-risney

@yannduran - Since the reply wasn't quite clear:

webview2 doesn't support C# yet. https://docs.microsoft.com/en-us/microsoft-edge/hosting/webview2#supported-platforms

Developer preview is available for Win32 C++ on Windows 10, Windows 8.1, Windows 8, and Windows 7. In the future, we plan to support WebView2 on .NET, and XAML.

OranguTech avatar Dec 13 '19 05:12 OranguTech

@yannduran @OranguTech

Yes, we do not currently support C# yet, but doing so is among our top priorities. After we release C# support, we plan to release a Sample Application in C#.

pagoe-msft avatar Dec 13 '19 18:12 pagoe-msft

@pagoe-msft

Why is this issue closed? Until C# samples are released this issue has not been addressed. It should remain open until that happens.

yannduran avatar Dec 14 '19 17:12 yannduran

Any update on a cross platform C# sample? (based on a console app not on wpf or winforms)

dangershony avatar May 26 '20 23:05 dangershony

As of now the WebView2 control is not cross-platform. We can look into building a console app sample. I'd love to get a sense of what you're building and what you'd like to use WebVIew2 for.

pagoe-msft avatar May 26 '20 23:05 pagoe-msft

I would really like to see a WPF sample actually. I should have specified that originally.

yannduran avatar May 27 '20 01:05 yannduran

There is suppose to be .NET Core support, is that through WPF or is it possible to spawn a webview2 window from a .NET Core console app?

https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/dotnet/0-9-515-reference-webview2

image

sondreb avatar May 27 '20 19:05 sondreb

@sondreb I too tried this a few days ago and go no success, so I fell back to normal .NET winforms and everything worked fine, so it appears to me at least that core support is not yet finished.

shawty avatar Jun 03 '20 14:06 shawty

@yannduran - a WPF sample is now published in WebView2Samples @sondreb / @shawty - .NET Core should work with WinForms. What issues are you running into? This is likely a bug on our end that we'd like to fix right away.

pagoe-msft avatar Jun 03 '20 15:06 pagoe-msft

@pagoe-msft I'm looking for a solution like "WebWindow", where I can cross-platform run a .NET Core app with logic, that hosts an HTTP endpoint that serves an web app UI. It shouldn't matter what the UI is, if it's JavaScript, Blazor, Angular, React, etc.

I'd like to avoid any dependency on Windows Forms. WebWindow is a good attempt, but that is just a proof-of-concept, would like for the WebView2 to support a scenario like the one I just described.

Then we (as an industry) can avoid distributing the Chromium and Node.JS runtime every time we build a desktop app with web technology. The Xbox Beta app recently migrated from Electron to React Native to reduce resource consumption (RAM).

sondreb avatar Jun 03 '20 15:06 sondreb

@pagoe-msft - Following this (https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winforms) I noticed that it also said:

image

Since I prefer core projects at the moment (I'm currently writing a book on Core with Packt) I opted for using Core, but no matter what I tried I could not get the WebView2 control to appear in the toolbox is VS19.

I'm on the VS19 Preview track, I installed the Canary Build for Edge, and no dice.

As soon as I switched over and tried the same instructions with regular .NET winforms, no problem, it all worked as expected.

I was actually going to report it as a different issue, I just forgot :-)

shawty avatar Jun 03 '20 16:06 shawty

@pagoe-msft

Thanks for the heads up. Though I would have liked to, I can't use WebView2 while it requires Canary build for Edge.

yannduran avatar Jun 04 '20 02:06 yannduran

@pagoe-msft Wanted to check if Webview2 provides support for accessibility - that lets screen readers like JAWS and NVDA recognize the rendered HTML elements?

alamathe1 avatar Jun 05 '20 02:06 alamathe1

I have to say that this sample application is profoundly complex. I know that is not what you want to hear, but I am stunned at the complexity of this technology.

HoldenPCaulfield avatar Jan 04 '21 02:01 HoldenPCaulfield

@HoldenPCaulfield to be fair it's really not. Seriously :-) that is actually a quite simple application, they just perhaps try to do to much in the one sample.

If you want complex, take a look at the custom browser I started to write using it :-)

shawty avatar Jan 04 '21 11:01 shawty