WebView2 Configuration - webview2/EdgeSharp GitHub Wiki


WebView2CreationOptions is class that has collection of commonly configurable WebView2 properties. Most EdgeSharp development may not need to make any changes, but advanced users may have need to make changes here and there. Part or entire WebView2CreationOptions can also be overriden in:

No Configuration

The default values will be used.

Overwriting the Default Configuration

using EdgeSharp;
using EdgeSharp.Core.Configuration;
using EdgeSharp.Core.Defaults;
using System;

namespace MyEdgeSharpApp
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // create a configuration with preset defaults
            var config = new Configuration();

            // your configuration
            config.StartUrl = "https://developer.microsoft.com/en-us/microsoft-edge/webview2/";
            config.WindowOptions.Title = "My Awesome EdgeSharp App!";

            config.WebView2CreationOptions.AdditionalBrowserArguments = "disable-web-security";
            config.WebView2CreationOptions.IsStatusBarEnabled = false;
            //..

            AppBuilder
            .Create()
            .UseConfig<IConfiguration>(config)
            .UseApp<SampleEdgeSharpApp>()
            .Build()
            .Run(args);
        }
    }
}