Beta 7.2 of C#/XAML for HTML5 released

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Beta 7.2 of C#/XAML for HTML5 released

Postby JS-Support @Userware » Wed Feb 24, 2016 11:54 am

Dear CSHTML5 users and forum members,

We are pleased to inform you that the Beta 7.2 of CSHTML5 is available for download!

The main new feature since Beta 7.1 is the brand new "CSHTML5.Interop.ExecuteJavaScript" method that lets you call JavaScript code from within your C# code!

The main advantages over the previous interop methods are:
  • It works both in the Simulator and in the output generated HTML/JS code!
  • It works under VS 2012, VS 2013, and VS 2015

Sample code and Extensions download:
We are working on the documentation for this feature. In the meantime, you can see it in action and learn how to use it by checking out following open-source extensions:
  • The ArcGIS Extensions, which shows how to wrap a popular JavaScript-based mapping library into a C#/XAML control that can be used in a C#/XAML-based cshtml5 application.
  • The WebSocket Extension, which shows how to wrap the native JavaScript "WebSocket" class into a C#-based class that can be consumed by a cshtml5 application.
  • The PrintHelper class, which calls JavaScript code to copy into a new browser window the portion of the HTML DOM that corresponds to the FrameworkElement that you specify, and then to call the "Print Dialog" of the browser.

Contribute by Creating Extensions:
If you would like to be part of this, please do create new extensions or contribute to existing ones. There are plenty of ideas to choose from, ranging from creating wrappers around popular open-source JS libraries (such as the amazing 3d engine "Three.js", great charting controls "Chart.js", iOS/Android hardware interop library "Cordova", native PDF reader "pdf.js", and so many more) to creating wrappers around commercial components such as Telerik Kendo UI, Infragistics, Syncfusion, ComponentOne, DevExpress, and many more, to implementing features requested on UserVoice such as SignalR. No matter whether you want to create an open-source, closed-source, or commercial extension, we will do our best to assist you as much as we can. To create an extension for CSHTML5, just create a new CSHTML5 Class Library, and share it :-) You can share it for example on the new Extensions section of the forums to get feedback from the CSHTML5 community.

Notes and limitations:
  • At the moment, the "LoadJavaScriptFile(url)" and "LoadCssFile(url)" methods only take absolute URLs (that start with http:// or https://). We are working on Beta 7.3 on the ability to embed JS files into an extension, and use relative paths. In the meantime, you can find online hosted JS files for most of the popular libraries at
  • You cannot use the "dynamic" keyword because JSIL has issues related to CallSites under the VS 2015 Roslyn compiler.
    However you can chain multiple "ExecuteJavaScript" calls, pass simple value types between C# and JS, pass complex object references from JS to C# (though you need to call ExecuteJavaScript again if you want to later interact with them), and even pass C# callbacks and delegates to JS!

Other New Features and bug fixes of this release:
  • New "Run from Localhost" option in the Simulator!
    It lets you test features such as Storage, Geolocalization, httpcalls, and other features that, on some browsers, are disabled when running from the "file:///" protocol.
  • New CSHTML5.Interop.LoadJavaScriptFile(url) and CSHTML5.Interop.LoadCssFile(url) methods to load additional JS libraries at runtime
  • New CSHTML5.Interop.GetDiv(frameworkElement) method to get the HTML DOM element that corresponds to the specified FrameworkElement
  • Fixed broken <WrapPanel/> control
  • Fixed "Type not found" compiler issue when using custom controls in XAML
  • Improved rendering of <Path/>, <Ellipse/>, <Rectangle/>, and <Line/> controls
  • Fixed issue where the <Path/> control didn't render properly if its properties were set after the control was added to the visual tree
  • Fixed issue where referencing 3rd party libraries could cause a compilation error saying that the compiler was unable to locate "CSharpXamlForHtml5.dll"
  • Added "Application.Current.RootVisual" (alias of Window.Current.Content")
  • Improved the way that the JavaScript error messages in the Simulator are reported
  • Added attributes to tell the minimum CSHTML5 version that the extension supports (useful for future backward compatibility with extensions)

Notes about installation:
  • Before installing the update, it is recommended that you close all the open instances of Visual Studio.
  • If for some reason you need to revert to the previous Beta, simply uninstall this one (from the Control Panel) and reinstall the previous Beta.

We hope you will enjoy this build.

If you find any issues, please post them on the forums or send an email to

Thank you.
(21.22 MiB) Downloaded 426 times

Posts: 36
Joined: Tue Feb 02, 2016 6:30 am

Re: NEW! Beta 7.2 of C#/XAML for HTML5 released! [Download]

Postby zemorango » Thu Feb 25, 2016 2:53 pm

works very well, i've tried the Esri Sample an it works like a charm :mrgreen:

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: NEW! Beta 7.2 of C#/XAML for HTML5 released! [Download]

Postby JS-Support @Userware » Fri Feb 26, 2016 3:11 am

Thank you zemorango!

Posts: 6
Joined: Fri Jul 17, 2015 10:20 am

Re: NEW! Beta 7.2 of C#/XAML for HTML5 released! [Download]

Postby labbr01 » Mon Mar 07, 2016 6:08 am

Very nice feature having «CSHTML5.Interop.ExecuteJavaScript» working in debugger

First i try with your ArcGIS Sample, and then i use the possiblility of having referenced Library in a another project to move all related ArcGIS API Stuff in an «Esri.ArcGIS.Client» project. Then i add to ArcGIS Silverlight API an «ArcGISDynamicMapServiceLayer» signature class, to be able to add this kind of layer, and change dynamicly the label visibility of the layer. Without this new feature capable of running in debug mode, i would have not been able to accomplish this.

I would had two question to this post:
1: Is it possible to change default startup debbuger mode from IPhone Portrait to Ipad Landscape? I did'nt saw any preference setting.

2: In debbuger mode, Is it possible to have relative name referenced javascript and .css file (loaded with the command «await Interop.LoadJavaScriptFile» and «await Interop.LoadCssFile») rather than an absolute name comming from an external web site (like the of the sample), in order to be able to customise javascript when needed? If the relative javascript file is in an external Library, how thoses file could be copy to the output directory of the main project when needed? with post build command?

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: NEW! Beta 7.2 of C#/XAML for HTML5 released! [Download]

Postby JS-Support @Userware » Mon Mar 07, 2016 10:24 am

Thanks a lot labbr01!

1: Not yet. This is expected for Q2 2016. We are also working on an option that gives you the ability to remove the phone appearance altogether, in order to simulate a resizable web browser window.

2: Beta 7.3, which is expected in the coming weeks, will let you use relative references. It will work the same as for Image files. You will be able to put JS and CSS files in your project, and they will be automatically copied to the Output folder.

Please stay tuned for updates.

Thanks again.


Return to “Pre-Releases, Downloads and Announcements”

Who is online

Users browsing this forum: No registered users and 2 guests