Welcome Guest Search | Active Topics | Sign In | Register

NewWindow on WPF project Options
Eurice
Posted: Monday, April 25, 2016 10:48:23 AM
Rank: Advanced Member
Groups: Member

Joined: 12/10/2014
Posts: 137
Hello guys,

I'm facing a little issue with newWindow event on wpf project.

My webcontrol is declared like in your documentation,

Code: HTML/ASPX
<eo:WebControl x:Name="webControleEO">
            <eo:WebControl.WebView>
                <eo:WebView x:Name="webViewEO" >
                </eo:WebView>
            </eo:WebControl.WebView>
        </eo:WebControl>


And I'd like to do something like this :

Code: C#
private void webViewEO_NewWindow(object sender, NewWindowEventArgs 
{
            e.Accepted = true;
            this.webViewEO = e.WebView; // error on this
}

But I can't because e.WebView is from the type "EO.WebBrowser.WebView" and my WebViewEO is "EO.WebBrowser.Wpf.WebView".

Is there any way to cast any webview to wpf.Webview ?
In the documentation I can read in the "EO.WebBrowser.Wpf.WebView" class description that it's "An alias for EO.WebBrowser.WebView."


Thanks you

eo_support
Posted: Monday, April 25, 2016 12:12:33 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You can not replace a WebView like this. You must replace it through the WebControl. For example, in your case you can use "webControlEO.WebView = e.WebView" instead of webViewEO = e.WebView.

Having that said, doing so will destroy the WebView that triggers NewWindow event while the event is still being handled. You can not do that. If you want to load the new Url in the current WebView, you can simply set the current WebView's Url to the new Url without setting e.Accepted to true.

Thanks!
Eurice
Posted: Tuesday, April 26, 2016 3:56:21 AM
Rank: Advanced Member
Groups: Member

Joined: 12/10/2014
Posts: 137
Yeah I was doing like that before; but I need to keep the relation between my webview and some website (not mine) just dont work anymore if I just pass the url.

The main problem is that I have many references to webViewEO in my project, and being able to cast the webview directly would save me a huge amount of time.


(Btw This is not a problem anymore)
eo_support
Posted: Tuesday, April 26, 2016 9:40:29 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
You can not cast the two. They are not the same. You can only update it through the WebControl class.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.