Table of Contents
- Getting Started
- EO.Pdf
- EO.Web
- EO.WebBrowser
- Overview
- Installation and Deployment
- Getting Started
- Customizing WebView
- Advanced Topics
- EO.Wpf
- Common Topics
- Reference
With WPF Project |
Follow these steps to use EO.WebBrowser in a Windows Form application in Visual Studio:
- Open your WPF project;
- Add reference to EO dlls;
- If you use .NET Core (including .NET 6 and newer), then add reference to nuget package System.Drawing.Common;
- Open a Window in XAML view;
-
Add "eo" namespace prefix in your XAML file. Simply add the following attribute to your Window or UserControl
XAMLxmlns: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.
-
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.