title: WebView2 Download progress
body: <p>Need to get download progress via WebView2. <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2downloadoperation?view=webview2-dotnet-1.0.865-prerelease" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2downloadoperation?view=webview2-dotnet-1.0.865-prerelease</a></p>
  <pre><code>async void InitializeAsync()
  {
    var env = await CoreWebView2Environment.CreateAsync(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @&quot;\Microsoft\EdgeCore\92.0.887.0&quot;);
    await webView.EnsureCoreWebView2Async(env);
    webView.CoreWebView2.DownloadStarting += webView_DownloadStarting;
    webView.CoreWebView2.Navigate(&quot;downloadURL&quot;);
  }
  
  private void webView_DownloadStarting(object sender, CoreWebView2DownloadStartingEventArgs e)
  {           
    e.ResultFilePath = filename;
    public event EventHandler&lt;object&gt; BytesReceivedChanged; &lt;-- Need this event for print bytes to webView_BytesReceivedChanged
    public event EventHandler&lt;object&gt; StateChanged; &lt;-- Need this event for print download state to webView_StateChanged
  }
  
  private void webView_BytesReceivedChanged(object sender, CoreWebView2DownloadStartingEventArgs e)
  {
    Console.WriteLine(e.DownloadOperation.BytesReceived); // Bytes received
    Console.WriteLine(e.DownloadOperation.TotalBytesToReceive); // Total bytes to receive
  }
  
  private void webView_StateChanged(object sender, CoreWebView2DownloadStartingEventArgs e)
  {
    Console.WriteLine(e.DownloadOperation.State); //2 Completed, 1 In progress, 0 Error
  }
  </code></pre>
  <p>I tried:</p>
  <pre><code>public event EventHandler BytesReceivedChanged;
  BytesReceivedChanged += webView_BytesReceivedChanged;
  </code></pre>
  <p>but event never fired</p>