Logo
My Account |  Site Map | Contact Us  

Custom Context Menu with EO.WebBrowser

All Products
EO.Web Controls
EO.Pdf for .NET
EO.Wpf for .NET
EO.WebBrowser for .NET
For Win Forms App
For WPF Apps
Custom Context Menu
.NET -> JavaScript
JavaScript -> .NET
Resource Handler
TabbedBrowser Sample
EO.WebBrowser allows you to completely replace the build-in context menu with your own custom context menu or add your own custom command by handling the WebView's BeforeContextMenu event. The following code demonstrates how to use this feature:
C# VB  
//Attach event handler
WebView1.BeforeContextMenu += new BeforeContextMenuHandler(WebView_BeforeContextMenu);

//Build a custom context menu in the event handler
void WebView_BeforeContextMenu(object sender, BeforeContextMenuEventArgs e)
{
    e.Menu.Items.Clear();
    e.Menu.Items.Add(
        new EO.WebBrowser.MenuItem("Essential Objects Homepage", m_nHomeCommand));
    e.Menu.Items.Add(EO.WebBrowser.MenuItem.CreateSeparator());
    e.Menu.Items.Add(new EO.WebBrowser.MenuItem("Back", CommandIds.Back));
    e.Menu.Items.Add(new EO.WebBrowser.MenuItem("Forward", CommandIds.Forward));
}

The following image shows the result of the above code:

EO.WebBrowser Context Menu

See here for detailed step by step instructions on how to customize the context menu.

Additional Resources

  • Product Documentation

    All features are explained in great details in the product documentation. It also contains complete reference information for each type, property or method;

  • Samples

    The download package contains a wide variety of samples with full C# and Visual Basic.NET source code that demonstrate how to use different feature of the EO.WebBrowser library.

  • Technical Support

    Still have questions? Post in our support forum or contact us and we will answer them quickly. Our turn around time is among the best in the industry.