In WinForm App (C#), to display progress (loading) in ProgressBar Control when WebBrowser load a page we can use this code:
private void WebBrowser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
WebBrowser wb = (WebBrowser)sender;
ProgressBar.Maximum = (int)e.MaximumProgress;
ProgressBar.Value = (int)e.CurrentProgress;
}
I tried this on WPF but it doesn’t work. Seems like the WPF WebBrowser doesn’t have ProgressChanged event.
I know we can use the WinForm WebBrowser in WPF, but I’m just curious to know is there a way for WPF WebBrowser to display current progress (loading a page) in progress bar?
There is no such Event in WPF control, However, you can use Loaded Event, or you can host the windows form control in WPF and get what ever events you want
see Hosting a Windows Forms Control in WPF