Reputation: 762
I'm would like to embed Internet Explorer into an WPF Windows Application. I have been searching for a way and found that i can make an reference to shdocvw.dll and created an instance of the Internet Explorer Class.
I'm able to open web pages, but it is still in an external window and i would like the page in an UIElement (like an Grid)
How do i do this ?
Upvotes: 2
Views: 2285
Reputation: 9244
Are you looking for embedding the Internet Explorer COM Object directly or just a control that does that for you? The WebBrowser control will fulfill that simple plop a web browser in a Grid need. It comes standard in WPF installations and is very easy to use.
<WebBrowser Source="http://msdn.com" Width="{INSERT WIDTH}" Height="{INSERT HEIGHT}" />
One caveat of this control is that I believe it always renders like IE7. To get it to render to a newer IE (like 11) you want to set the meta tag on the target pages like shown in the following code.
<meta http-equiv="X-UA-Compatible" content="IE=edge">
It can also be set to IE=11
explicitly. Remember to set the document types There are other ways to trigger a newer IE experience, but this by far is easiest if you control the embedded web pages.
There are also third-party libraries that can give you even more functionality.
Upvotes: 4