MicrosoftEdge / WebView2Samples

Microsoft Edge WebView2 samples
862 stars 466 forks source link

C# Samples #2

Open yannduran opened 5 years ago

yannduran commented 5 years ago

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!

david-risney commented 5 years ago

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

OranguTech commented 4 years ago

@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.

pagoe-msft commented 4 years ago

@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#.

yannduran commented 4 years ago

@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.

dangershony commented 4 years ago

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

pagoe-msft commented 4 years ago

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.

yannduran commented 4 years ago

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

sondreb commented 4 years ago

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

shawty commented 4 years ago

@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.

pagoe-msft commented 4 years ago

@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.

sondreb commented 4 years ago

@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).

shawty commented 4 years ago

@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 :-)

yannduran commented 4 years ago

@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.

alamathe1 commented 4 years ago

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

HoldenPCaulfield commented 3 years ago

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.

shawty commented 3 years ago

@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 :-)