Take the 2-minute tour ×

I’m trying to run Google earth inside WPF but I don’t know how. Basically I have managed to run Google Earth in a Windows Form Control inside a Windows Form, everything was OK.

Trying to do the same thing in WPF, well, give strange result a small Google Earth screen placed anywhere in the form an not inside the User Control I have created, and there is now way to make this Google Earth Control grow, or shrink, when I grow or shrink the WPF Form.

Any help would be appreciated, I really mean any!

share|improve this question
Not really what you are asking, but did you considering embedding Google Maps instead? You would have less problems with winForm/interoperability and also wouldn't need google earth to be installed. (Please ignore my comment if for some reason you really need google earth) –  Francesco De Vittori Aug 30 '10 at 14:02
add comment

2 Answers

If you have a Windows Forms control that already works exactly as you want, you could always use WindowsFormsHost to put that control on your WPF form. That might be the easiest thing to do... or is that what you're already doing that isn't working?

share|improve this answer
add comment

I also wrote an application that placed Google Earth inside a WinForms WebBrowserControl that was based on the more-or-less official example hosted by Google. It worked fine. I struggled to recreate the same application inside a WPF WebBrowserControl. My experience confirms what appears to be the general consensus that the WPF WebBrowserControl is harder to use because it provides less control. (e.g. With the WinForms WebBrowserControl you can use the properties to remove the scroll bar and eliminate the IE security question on startup, but with WPF WebBrowserControl you have to use kludges inside to HTML file loaded to get the same effect.) If you are following the Google GE plugin WinForms example, you have to move the JavaScript callback functions into a separate class because of WPF window cant be a parent of the .Net-COM interop between JavaScript and C#. Maybe the other artifacts you described are due to how you resolved this latter limitation. Before finding this solution, I was tempted to put the WinForms WebBrowser control inside the WPF window, but others have posted of unpleasing side-effects of doing this.

share|improve this answer
add comment

Your Answer

