Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Edge control in an X# application 27 Mar 2019 21:17 #8072

  • wriedmann
  • wriedmann's Avatar
  • Topic Author


  • Posts: 3198
  • Hi all,

    it is a common requirement these days to have a webbrowser control in a Windows application. For this we can use the Internet Explorer control. But since the IE is very limited, now there is the possibility to have Edge as control, but it needs at least Windows 10 version 1803 or 1809.
    Please see this page: docs.microsoft.com/en-us/windows/communi...wpf-winforms/webview

    And today I was able to make it work in a WPF application written in pure X#:

    The code is really simple:
    oWebView := WebView{}
    oWebView:Name := "WebBrowser"
    I have added a XIDE export file here (it contains also the needed control, extracted from the relative Nuget package):

    File Attachment:

    File Name: WebViewWPFApp.zip
    File Size:138 KB

    The Nuget packages are here (please don't use the prerelease version, it does not work):
    www.nuget.org/packages/Microsoft.Toolkit...bView/6.0.0-preview3
    www.nuget.org/packages/Microsoft.Toolkit...bView/6.0.0-preview3

    Unfortunately until now I was not able to make work the WinForms version - it would be cool thing to add such a control as OLE control in VO applications.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Edge control in an X# application 27 Mar 2019 23:14 #8074

    • George
    • George's Avatar


  • Posts: 106
  • Wolfgang

    very interesting!

    My apps use the .Net WebViewer and I think I have to change it.
    I will give it a try in a WinForm application.

    thanks
    George

    Please Log in or Create an account to join the conversation.

    Edge control in an X# application 28 Mar 2019 08:34 #8079

    • Fabrice
    • Fabrice's Avatar


  • Posts: 302
  • Hi Wolfgang,

    may I suggest to take a look at CefSharp (cefsharp.github.io/ ) ?
    Works with Framework 4.5.2; Exist in WinForms or WPF flavour, and available as a NuGet package

    HTH,
    Fabrice

    Please Log in or Create an account to join the conversation.

    Edge control in an X# application 28 Mar 2019 09:13 #8081

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3198
  • Hi Fabrice,

    thank you very much! I will try it out. Until now I had only found paid packages, with prices varying from 800 to 2000 Euro/year.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Edge control in an X# application 28 Mar 2019 09:23 #8083

    • Fabrice
    • Fabrice's Avatar


  • Posts: 302
  • Wolfgang,
    I've used it in C# project with Students : Easy to use, build on Chromium...even Microsoft has embrace WebKit, so it might be a good solution ! :)
    And for an X# usage, the NuGet package is a luxury !

    Regards
    Fabrice

    Please Log in or Create an account to join the conversation.

    Last edit: by Fabrice.

    Edge control in an X# application 01 Apr 2019 23:04 #8144

    • ic2
    • ic2's Avatar


  • Posts: 1555
  • Hello Wolfgang,

    This is really interesting. We use a OCX which is unfortunately not maintained by the maker to edit & display e-mails. We would love to replace it by something else for 2 main reasons:
    1 We would like to edit text and have a direct spell check as I have in Firefox where I can also select the language.
    2 When we control click a hyperlink it always opens in IE regardless the default browser.

    However none of the above works in the Edge based control. It is not even possible to open a hyperlink in your own browser (Ctrl or Shift Click doesn't do anything) and there is no spell check either.

    I checked the same in Edge (which i never use) and see that Ctrl or Shift click doesn't use my default browser either (it opens a new Edge or Edge tab) and spell check is also apparently been to difficult for Microsoft to implement :).

    There is a right mouse menu with Paste/Select all/Print/Read aloud in it, which is missing in the control exe as well.

    Do you think this behavior can be changed using the control?

    Dick

    Please Log in or Create an account to join the conversation.

    Edge control in an X# application 02 Apr 2019 06:00 #8145

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3198
  • Hi Dick,

    I don't know what Edge gives for possibilities. I have also tried CefSharp which Fabrice had suggested, but I was not able to make it work - it seems to have to do with the fact that it needs different DLL sets for x86 and x64.
    But Edge itself is changed, so in a foreseable future it will loose its own engine and use Chromium (the engine used by Chrome).
    Spell check is a difficult thing, specially for non-english languages because it needs dictionaries and more logic.
    In the Edge based control you have a callback when a link is clicked, and therefore you can decide what to do with it. (this also the case with the IE based control).
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Edge control in an X# application 02 Apr 2019 09:16 #8146

    • Fabrice
    • Fabrice's Avatar


  • Posts: 302
  • Hi Wolfgang,

    sorry to hear you had trouble to make CefSHarp working...
    So, I've tried myself to make it with X# (as I said before, I had only done it with C# in a student project).

    Ok, it was a bit tricky, but it's ok now...and by the way, I've found different problem with my VS Integration ;)


    I can send you my working project, and maybe should do an "How-to" article about it...or better, create a Video for the XSharp Academy on YouTube...24h/Day is definitively too short !
    Attachments:

    Please Log in or Create an account to join the conversation.

    Last edit: by Fabrice.

    Edge control in an X# application 02 Apr 2019 09:26 #8147

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3198
  • Hi Fabrice,

    I've tried first using XIDE (some things are simpler there <g>), but strangely in the CefSharp version I have there is no more an static Initialize() method in the Cef class - I've looked also with Reflector to be sure, but it is not there.
    Then I have tried using Visual Studio and NuGet, but I was not able to set the platform to x64 or to x32, since AnyCPU does not work.
    Unfortunately, in my experience, open source projects sometimes have the bad habit to change interfaces or something else and don't try to make things easier.
    I have suspended (but not stopped!) my tries to make it work - it is too important to have a working browser available in my applications.
    And CefSharp seems to have some very unique features, like access from Javascript to the internal objects of the C#/X# side, and the possibility to call JavaScript methods from the C#/X# side.
    The most important for me would be to have a working HTML editor, but they seem to be available only as JavaScript applications, not as Windows components. So the way to go seems to be an embedded browser with an embedded JavaScript HTML editor.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Edge control in an X# application 02 Apr 2019 10:13 #8148

    • Fabrice
    • Fabrice's Avatar


  • Posts: 302
  • Wolfgang,

    in fact there are several showstopper :
    You will need to edit the XSharp project file and put some "magic" there, then add an app.config with some settings
    ...and the Initialize method is here, but I (currently) don't know why it doesn't appear with Intellisense (one of the problem)

    I will check the HTML editor part, and come back with some "Step-by-step" instructions...for Visual Studio, sorry ;)

    Please Log in or Create an account to join the conversation.

    Last edit: by Fabrice.

    Edge control in an X# application 02 Apr 2019 10:44 #8149

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3198
  • Hi Fabrice,

    in XIDE it is really simple to change the platform between x86, x64 and AnyCPU, but in Visual Studio it is not so easy as it should be.
    Maybe I really have to edit the project file manually....
    The CefSharp people should look at the solution the SQLite people has adopted: they have a common, AnyCPU assembly that loads the correct platform DLL from the correct subfolder:

    But as I wrote: I have some urgent projects to finish (and yes, they are in X#) and after that I will again look at the browser control.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1