Rank: Advanced Member Groups: Member
Joined: 12/1/2014 Posts: 57
|
I hope I am not embarrassing myself with this question. In your getting Started documentation you give an example with WinForm on how to use a WebView directly - what would be the equivalent in WPF? I'm trying to figure out what the WPF WebControl does when a WebView is assigned to it. Thank you.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
The only thing the WebView class needs a window handle. So all you need to do is to somehow get a window handle and pass that handle the WebView.Create method. Like any Windows application, window handles are everywhere --- for example, your Window object should have a window handle. Or you can get a handle by calling windows API CreateWindow. However the key difference between a WPF application and a Windows Forms application is WPF uses a single window handle for the Window and all child controls in that window, where as Windows Forms uses a separate window handle for each control. Since you would rarely want the WebView to occupy your whole Window, you usually do not have a handle to use directly with the WebView in a WPF application since the only handle ready to be used out of box is the handle of the Window object itself. One of the most important purposes of the WPF WebControl is to solve this problem by creating a separate handle and pass it to the WebView.
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 12/1/2014 Posts: 57
|
Thank you. I made my own wrapper so I thought the WPF WebControl was maybe not needed. It seems from your response that it does more than I thought so I will keep it inside my own wrapper.
|