NEW!
CSHTML5 has now become OpenSilver!

We are happy to announce that CSHTML5 has been significantly improved and rebranded to 'OpenSilver', which stands for 'Open-source reimplementation of Silverlight'. It is fully backward compatible and it can be downloaded from OpenSilver.net. Upgrading from CSHTML5 to OpenSilver is very easy.
Read the FAQ

Beta 13 is here! See what's new


December 20, 2017 — The new beta 13.0 of C#/XAML for HTML5 is available! The free Visual Studio extension that enables developers to create HTML5 apps using only C# and XAML has reached a new milestone. With both bug fixes and new features, this update is recommended to all users.

 

What's new since Beta 12.0:

 

❶  Faster Compilation

 

❷  Revamped WCF / SOAP stack

  • You can use the "Add Service Reference" feature of Visual Studio and it will work as you expect!
  • Most of the limitations of the previous WCF implementation are gone. In particular, the attribute [XmlSerializerFormat] is no longer required on the server. Note: you still need to specify the endpoint programmatically
  • Your application will load faster and run faster because 20 times less code is generated for WCF
  • Improved SOAP compatibility (support for namespaces, ServiceKnownTypes, and much more!)
  • The Simulator now uses the same implementation as the browser, so if it works in the Simulator it will also work in the browser! (except that cross-domain calls from the browser require CORS)
 

❸  XDocument and Linq to XML

  • Support for XDocument.Parse, XElement, XAttribute, XName, XNamespace, and and most of the other Linq to XML features
 

❹  DataContractSerializer

  • Faster, lighter, and more versatile than the previous XmlSerializer implementation
  • More information and examples can be found here
  

❺  Improved XAML inspection during runtime

  • Instantly know the name of the XAML files where the UI elements are defined, by simply clicking "Inspect Visual Tree" and selecting a UI element while the application is running in the Simulator:

 

❻  Great new community extensions

 

❼  Option to generate HTML/JS files during the build process instead of the Simulator

  • Documented here
  • You can compile projects via command line using "msbuild.exe MySolution.sln".
  • Visual Studio is no longer required: only the Msbuild tools and the NET Framework 4.5 Targeting Pack are required to compile. More information can be found here
 

❽  Tens of XAML and .NET compatibility improvements

  • Queue<T>
  • NumericUpDown
  • RepeatButton
  • Application.Current.MainWindow
  • Application.Startup
  • Application.OnLaunched
  • Application.Exit
  • Application.Closing
  • ClickMode.Press
  • ClickMode.Release
  • ChildWindow.ShowAndWait() (with async/await)
  • UIElement.OnLostPointerCapture
  • UIElement.PointerCaptureLost
  • ButtonBase.IsPressed
  • FaultContractAttribute
  • TemplatePartAttribute
  • TemplateVisualStateAttribute
  • You can now display a confirmation dialog when the user attempts to close the window. To do so, just set e.ShowCloseConfirmation = true in the Closing event
  • UIElement.AddHandler and RemoveHandler (including support for catching handled events)
  • With BitmapSource.SetSource(string dataUrl) you can now load a bitmap from a "DataURL", which is particularly useful when used in conjunction with the FileOpenDialog extension
  • And more!
 

❾  The Simulator now renders the same as the browser

  • The Simulator has a new rendering engine that is based on Chromium 60 rather than Chromium 18, so it is now compatible with the latest HTML5 features, including the CSS Grid Layout for rendering the XAML Grid accurately
  • Although the Simulator is slower than the browser, it is very useful because it allows to debug the C# code and to inspect the XAML UI at runtime
 

❿  More than 50 other improvements and bug fixes!

  • Default app background (and loading screen) is now white rather than gray to be more in line with web pages. You can revert to the previous color by simply modifying the file "cshtml5.css" located in "C:\Program Files (x86)\MSBuild\CSharpXamlForHtml5\InternalStuff\Libraries".
  • Fixed VS 2017 compilation error
  • Clicking on an error in the Errors pane now correctly jumps to the error location in XAML files
  • [Breaking Change]: changed the namespace of the MessageBox class so that it is now located in the same namespace as the other UI classes. This is more aligned with the .NET Framework, and it also makes the MessageBox class immediately accessible when creating a new project.
  • New option in the Simulator "Tools" menu (bottom-left corner of the Simulator) to help debug the "Interop.ExecuteJavaScript" calls. When enabled, a folder named 'TempDebugCshtml5' is created on your desktop that contains a file named 'index.html' and a JS file that contains all the Interop.ExecuteJavaScript calls. Just open that file with your browser and use the Browser Developer Tools to debug the code. In particular, you can look for errors in the browser Console output, and you can enable the 'Pause on caught exceptions' option in the Developer Tools to step into the code when an error occurs.
  • Improved TypeScript Definitions Import tool (fixed issues when importing the WebGL TypeScript definitions - an example will come soon)
  • Added "UriHelper.ConvertToHtmlPath(string uri)" to convert a URI from the MS style (such as ms-appx:///AssemblyName/Folder/Image.png or /AssemblyName;component/Folder/Image.png) to the HTML style, which is particularly useful when writing HTML/JS manually via C#/JS interopand/or the HtmlPresenter
  • The default display size in the Simulator is now "Desktop Browser" rather than "Phone" because there are more users that target desktop browsers
  • The default display size in the XAML Editor is now "Fit Screen" rather than "Phone"
  • To help avoid mistakes, a compilation error now appears when you attempt to use "Interop.ExecuteJavaScript" without passing a string literal
  • Added more overloads for "String.LastIndexOf" that take a "startIndex" as parameter
  • Easier Silverlight Toolkit migration because the namespace "http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" now points to the built-in "System.Windows.Controls"
  • TextBlock text no longer overflows outside of the TextBlock
  • Fixed the "ArrayList" class
  • Fixed the "RadioButton.IsChecked" property
  • Fixed the CheckBox control under IE
  • Fixed "e.OriginalSource" in the event args of the pointer event handlers
  • Fixed an issue where if some XAML direct text content was placed after some properties, it was ignored
  • Fixed an issue where direct text content inside a XAML property element was not supported
  • WebClient now correctly throws an Exception when the server returns an error (the response has a status between 400 and 600)
  • Fixed design-time error "Type 'RelativeSource' is used like a
  • Fixed multiple issues related to ArcSegment
  • markup extension but does not derive from MarkupExtension"
  • Fixed the fact that the XAML preview did not preview bindings (now only bindings with converters are not previewed)
  • Improved the reliability of VisualTreeHelper.GetChildren and VisualTreeHelper.GetChild - Improved RangeBase
  • Fixed design-time error "No constructor for type 'RelativeSource' has 1 parameters"
  • Improved XAML Inspector in the Simulator
  • Fixed issue where a coerced value did not raise the "property changed" event. The issue could be reproduced by using C# to add a NumericUpDown with a given non-zero Value to the visual tree after the tree was loaded: the value was not rendered.
  • MessageBox.Show now correctly releases the pointer capture
  • Ability to change DataGrid.SelectionMode on the fly
  • DataGridCells now correctly limit the display size of their content
  • Fixed Enum.TryParse
  • Fixed DataGrid left margin when SelectionMode==DataGridSelectionMode.Single
  • Fixed the Setter of Selector.SelectedValue (for example ComboBox.SelectedValue)
  • Fixed PasswordBox.Password property binding and PasswordChanged event.
  • Fixed implementation of GetHashCode and Equals for Tuple
  • Fixed ToolTip issue where replacing a tooltip with another did not refresh the open tooltip
  • Fixed an issue where the TabControl did not refresh properly when adding/removing TabItems
  • Worked around an issue that prevented the XmlReader from working in browsers
  • Fixed an issue with the serialization of DateTime when the TimeZone was a negative 1 digit hour
  • Fixed an issue where the selection did not appear correctly when ItemsControl.ItemsPanelTemplate was set (for example in ListBox)
  • Fixed an issue with the "Interop.ExecuteJavaScript" method where passing a URL (or another type that overrides the "ToString" method) did not result in quotes being added to the javascript code to call.
  • The ComboBox now correctly inherits the FontSize
  • Fixed the JavaScript error: "Cannot read property 'createElement' of null"
  • Clicking outside a templated ComboBox closes its drop-down menu
  • Fixed an error in browsers related to "NumericTypes" (was a warning in the Console)
  • Improved XAML Preview in the XAML editor (support for custom types as root of the XAML, fixed errors when TargetType is not supported, fixed content that would go outside the display area, and more)
  • Fixed an issue where applying a style to the root of the XAML did not work (for example if you applied a style to a ChildWindow in XAML)
  • Fixed an issue where pasting on a TextBox with a MaxLength could result in the text exceeding the defined max length.
  • Fixed the OverflowException that happened when an enum value inherited from a ULong bigger than a Long
  • Fixed an issue where the compilation error "No default content property exists for element" was displayed in case of enums declared in XAML
  • Fixed an issue where two <Run> tags where not rendered separated by a space
  • Fixed default(nullable)
  • Added more "migration tips"
 


Download Now (Free):

  • To download now, go to www.cshtml5.com and click Download.

    Users who registered for one of the previous betas have been sent an email containing the download link. If you have not received it, please contact us.




Please vote for your most wanted features on
UserVoice.

Want to migrate a Silverlight application to the web? Read our Silverlight Migration Guide.

 

About C#/XAML for HTML5:

C#/XAML for HTML5 is a free extension for Visual Studio that enables developers to create cross-platform HTML5 apps exclusively using C# and XAML.

It is designed for developers using C#, XAML, and Visual Studio to extend application reach to platforms outside the Microsoft ecosystem, including Android, BlackBerry, Chromebook, iOS, Linux, Mac OS, and web browsers. It can be used to migrate Silverlight apps to HTML5, as well as to create new client-side rich web applications without manipulating HTML, CSS, and JavaScript.

Benefits over alternative cross-platform development tools include zero learning curve for C#/XAML developers, a robust well-organized strongly-typed development experience, the ability to share C# code between the client and the server, and the ability to port legacy apps to the modern web with minimal effort, notably to convert Silverlight apps to HTML.

More information and download can be found at: www.cshtml5.com


About Userware:

Userware is a software company founded in 2007 by two experts in Microsoft technologies. It has gained popularity in the recent years for consumer apps such as XLS Editor (#1 Paid Productivity App in the Windows Store for 8 consecutive months), and WikiOS.org, a patent-pending online operating system made in Silverlight that can be enhanced Wiki-style by users using an online development environment. With "C#/XAML for HTML5", Userware aims to enable all C#/XAML developers to build cross-platform HTML5 apps with the skills, tools, and code base they already have.

Userware is online at: www.userware-solutions.com


Contact:

You can contact the team behind C#/XAML for HTML5 at: hello@cshtml5.com

 

For more information, please visit www.cshtml5.com