Logo
My Account |  Site Map | Contact Us  
 The same content in Microsoft HTML help file format is included in the download package.
Using EO.WebBrowser With WPF Project

Follow these steps to use EO.WebBrowser in a Windows Form application in Visual Studio:

  1. Open your WPF project;
  2. Add reference to EO dlls;
  3. Open a Window in XAML view;
  4. Add "eo" namespace prefix in your XAML file. Simply add the following attribute to your Window or UserControl

    XAML
    xmlns:eo="http://schemas.essentialobjects.com/wpf/"

    For example, your Window element may look like this:

    XAML
    <Window x:Class="Test.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="250" Width="350">

    After adding the "eo" namespace prefix it becomes this:

    XAML
    <Window x:Class="Test.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:eo="http://schemas.essentialobjects.com/wpf/"
            Title="MainWindow" Height="250" Width="350">

    Note the additional "eo" prefix added to the Window element.

  5. Add an "eo:WebControl" element to your Window:

    XAML
    <eo:WebControl>
        <eo:WebControl.WebView>
            <eo:WebView Url="www.google.com">
            </eo:WebView>
        </eo:WebControl.WebView>
    </eo:WebControl>

    Note that the WebControl element must have its WebView property set to a WebView object.

    Alternatively, you can set Url from code:

    XAML
    <eo:WebControl>
        <eo:WebControl.WebView>
            <eo:WebView x:Name="webView1">
            </eo:WebView>
        </eo:WebControl.WebView>
    </eo:WebControl>

    Then you can use webView1 in your code:

    //Load Google's homepage into the WebView
    WebView1.Url = "www.google.com";

Now you can use all EO.WebBrowser features through the WebView object.


Direct link to this topic