-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BlazorWebView: Allow for WPF and WinForms WebView2 Custom Startup Settings and Fixed Distribution Mode #5086
BlazorWebView: Allow for WPF and WinForms WebView2 Custom Startup Settings and Fixed Distribution Mode #5086
Conversation
Thanks for the contribution, @MichaelPeter! As it stands, I'm not absolutely sure we intend to include APIs for this in the initial release. We made a specific plan to keep "fixed distribution" mode out of scope for the first release, as it creates a lot of potentially different deployment combinations that we're not in a position to document, support, or debug (if people hit issues) while working on such a short timescale. We were expecting to add this in the next release when we have more flexibility around support. As far as I'm aware, it is technically possible to achieve this already without needing a supported API from dotnet/maui. That is, the WebView2 control looks for the following environment variables documented here:
... which can be used to control the things it looks like you need. You can assign values to these variables from your .NET code during application startup before the WebView2 control is instantiated. Could you let us know if this is technically sufficient for your goals? I know it's more obscure than having a supported API inside the BlazorWebView code, of course! |
Thank you @SteveSandersonMS for the hint, I was aware of As a hint:
But As TargetCompatibleBrowserVersion a webgpu compatible version is installed, but ensureing a compatible version can also be checked differently, even if more diffcult. |
Thanks @MichaelPeter. I've filed #5512 to follow up on the |
Hi @MichaelPeter , with PR #5802 merged, I think there are now enough events and hooks to customize various WebView2 startup settings (and similar on other platforms in .NET MAUI). Is it safe to close this PR now because there is enough functionality? |
As per Eilon's comment, closing this one. @MichaelPeter thank you so much for all your efforts. If you believe this is still necessary please let us know and we'll gladly reopen this and see if we can get this merged. |
Description of Change
Currently it is not possible to use WebView2 Fixed Distribution mode since the Blazor WebView creates a custom Environment which cannot be modified. This also prevents:
See WebViewInitialize
This is a implementation which was implemented based on a suggestion in the issue.
Other issues related to that
#2548
Uncarlities:
The WPF Version used a EventHandler<> Delegate Depedency Property for ExternalNavigationStarting. It is not clear why no WPF RoutedEvent is used for events. In WinForms it is also an EventHandler<> delegate, even thought for Windows Forms Controls, events are also more common.The new InitializingWebView is an RoutedEvent in WPF. In Windows Forms it is an EventHandler Delegate Property.
Could change InitializingWebView after an explanation also to EventHandler<> in WPF too. But wanted to leave it like that will I know why an EventHandler is use.
Issues Fixed
#3861
#2548