ResourceHandler can help you to determine whether resources such as HTML, Images, JavaScript & CSS files, favicon, etc. should be loaded or not. By default all resources are loaded. To modify default behavior you need to register your own ResourceHandler implementation. For example:

class SampleResourceHandler : ResourceHandler {

public bool CanLoadResource(ResourceParams parameters) {
bool isImageType = parameters.ResourceType != ResourceType.IMAGE;
if (isImageType) {
return true;    // Cancel loading of all images
}
return false;
}
}


This implementation cancels loading of all images. Using same technique you can implement and register your own ResourceHandler where you can cancel loading of required resources.


Example

MainWindow.xaml

<Window x:Class="WPF.ResourceLoading.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" Closing="Window_Closing">
    <Grid Name="mainLayout">

    </Grid>
</Window>


MainWindow.xaml.cs

using System;
using System.IO;
using DotNetBrowser;
using DotNetBrowser.WPF;
using System.Windows;

namespace WPFResourceLoading
{
    public partial class MainWindow : Window
    {
        Browser browser;
        WPFBrowserView browserView;

        public MainWindow()
        {
            InitializeComponent();

            browser = BrowserFactory.Create();
            browserView = new WPFBrowserView(browser);
            mainLayout.Children.Add(browserView);

            NetworkService networkService = browser.Context.NetworkService;
            networkService.ResourceHandler = new SampleResourceHandler();

            browserView.Browser.LoadURL("http://www.teamdev.com");
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // Dispose BrowserView when close app window.
            browserView.Dispose();
            browser.Dispose();
        }
    }


    class SampleResourceHandler : ResourceHandler {

        public bool CanLoadResource(ResourceParams parameters) {
            Console.WriteLine("URL: " + parameters.URL);
            Console.WriteLine("Type: " + parameters.ResourceType);
            bool isImageType = parameters.ResourceType != ResourceType.IMAGE;
            if (isImageType) {
                return true;    // Cancel loading of all images
            }
            return false;
        }
    }
}