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

CSHTML5 Goes Open-Source!

 

March 11, 2019

Today marks a very special day with 5 major announcements:

 

1. CSHTML5 Goes Open-Source!

After 5 years of only proprietary licensing, CSHTML5 is now open-source!

CSHTML5 – also called 'C#/XAML for HTML5' – has become popular among developers as the first production-ready solution to make web apps in C# and XAML. It is also the only tool that enables to port existing Silverlight and WPF applications to the web, by compiling C# and XAML files to HTML and JavaScript.

Making it open-source is part of the effort to make CSHTML5 a more open and flexible platform for developers.

The source code is now available on GitHub under the GNU General Public License (GPLv3) license.

  

2. New 'Community Edition' Makes Previously Paid Features Free For Hobbyists

All the features that were previously only available in the paid 'Professional Edition' are now free to use as part of the new 'Community Edition', which is for hobbyists, open-source projects, and academics.

The 'Community Edition' can be downloaded here.

  

3. Commercial Licenses Are Available For Freelancers And Organizations

CSHTML5 is now dual-licensed, meaning that it is available under both the open-source license and commercial licenses.

Commercial licenses allow freelancers and organizations to make proprietary commercial products. Multiple tiers are now available so that the cost of the license is now adapted to the size of the company.

Commercial licenses can be purchased here.

  

4. New Version 1.2 Released With 40+ New Features!

Today we are also releasing the version 1.2 of CSHTML5, with many exciting new features!

You can read the full changelog below. New features include support for implicit styles, Themes, Generic.xaml, DefaultStyleKey, Focus states, TabIndex, DatePicker, TimePicker, Improved WCF (authentication, async calls with callbacks...), Improved DataGrid (paging...), x:FieldModifier, XmlnsDefinitionAttribute, and much more.

The new version 1.2 can be downloaded here.

  

5. There Are Major New Features Planned For 2019

We have updated our roadmap with our plans for 2019 and 2020.

You can read the updated roadmap here.

 

That's it for now, we hope you like these announcements! Please be sure to send your feedback to hello@cshtml5.com, we are looking forward to hearing from you!

 

 

Press Kit:

- Press Release: press_release_cshtml5_goes_open_source.docx (Word, 14KB)

- Logo: cshtml5_high_resolution_logo.png (PNG, 1700px*1700px, 60KB)

 

 

Full changelog of the new version 1.2:

New features and improvements:

  • Support for event-based asynchronous WCF SOAP calls! (Async/Completed+=...). NOTE: task-based asynchronous calls, and synchronous calls were already supported.
  • Support for Focus! This includes focus-related UI cues, focus navigation with the Tab key, focus-related VisualStates, GotFocus and LostFocus events on UI element, IsTabStop property, and more. NOTE: If you do not want to display the default focus rectangle, either apply a ControlTemplate with an empty Focused VisualState, or set the "IsTabStop" property to False, or set the "UseSystemFocusVisuals" property to False.
  • Support for authentication/credentials in web service calls.
    * In case of SOAP, the system will attempt to enable credential-related cookies, and if this is not supported, will fallback to normal calls.
    * In case of REST, you can use the new "WebClientWithCredentials" class instead of the "WebClient" class in order to support credentials-related cookies. You can use the property "WebClientWithCredentials.CredentialsMode" and "Application.Current.Host.Settings.DefaultSoapCredentialsMode" to change the behavior.
  • Added support for "IsolatedStorageFile.DeleteFile"
  • Added support for .cur resources (Note: like with all other resources, you need to set their "BuildAction" to either "Content", "Resource" or "EmbeddedResource" in order for the file to be properly copied to the JS output)
  • Improved data binding behavior when binding between values that have incompatible types (such as binding an Int32 with Boolean)
  • Improved Control.Focus() so that it returns a boolean stating whether the element actually got the focus or not
  • Support for Control.UseSystemFocusVisuals
  • Support for DatePicker and TimePicker. The implementation is powered by "flatpickr.js"
  • Ability to Drag the ChildWindow
  • The ChildWindow now has a semi-transparent background overlay. Note: the ChildWindow style and template can be customized: you will find the default one here.
  • Support for Popup.StayOpen
  • Much improved "TypeScript Definitions to C#" compiler for accessing JS libraries in a strongly-typed manner
  • Improved <Image> control alignment and stretch
  • Revamped DataGrid control! Now supports PagedCollectionView for programmatically filtering and sorting + Built-in paging (default page size is 20 items, you can change it by setting the DataGrid.DataPager.PageSize property, set to -1 for no limit) + Alternate row background
  • Much improved performance of Linq to XML (XDocument, XElement, XAttribute, etc.) and the DataContractSerializer
  • Added the possibility to create a XmlReader directly with a string for better performance, via XmlReaderHelper.Create(string xml)
  • Added DataPager control
  • Added support for IEnumerable.DefaultIfEmpty
  • Default padding of buttons is now the same as in Silverlight and other XAML platforms (3,3,3,3)
  • Added Cshtml5_XmlReader and Cshtml5_XmlWriter as temporary workarounds for the lack of features of the built-in XmlReader and XmlWriter
  • Improved the default style of HyperlinkButton
  • Made the option "use http://localhost" more visible in the Simulator
  • Improved Interop.ExecuteJavaScript to add support for Action<T> callbacks where T is a primitive or string type (no longer limited to T being "object")
  • Support for "Task<T>.FromResult"
  • Support for "Uri.EscapeDataString"
  • Support for redirection from a single sign-on service
  • Added the property "DataGrid.PageSize" that redirects to "DataGrid.DataPager.PageSize". Default value is 20 items per page. Set to -1 to disable paging.
  • Improved performance of XNode.ToString() and formatted XML serialization
  • Support for Implicit styles!
  • Support for DefaultStyleKey and "themes/generic.xaml"
  • Improved the WCF test application at: http://cshtml5.com/downloads/TestCshtml5WCF.zip
  • Added option to format/indent the XML produced by the DataContractSerializer.SerializeToString(...) method
  • Support for ThemeResources, ThemeDictionaries, and built-in system colors/brushes
  • Support for Application.TryFindResource(...)
  • Support for defining "Storyboard.TargetName" at the Storyboard level (in addition to the already supported Animation level)
  • Support for HashSet2.IntersectWith
  • Support for TextBox.CaretBrush (note: Edge does not support changing the caret brush color at the time of writing)
  • Added more namespaces so that there is no need to remove the "using" directives when migrating a Silverlight or WPF app, to make migration easier ("Microsoft.Win32", "System.Configuration", "System.IO.IsolatedStorage", etc.)
  • Improved StaticResourceExtension so that it now also looks in the Application's built-in resources if it couldn't find the resource in the XAML
  • Tooltips now automatically disappear after 5 seconds (like in other XAML platforms such as Silverlight)
  • Added built-in "BooleanToVisibilityConverter" (like in WPF)
  • Support for x:FieldModifier
  • Support for StaticResources inside attached properties
  • Support for attached properties with prefixes in XAML
  • Improved the performance of XDocument.Parse(text)
  • Support for namespaces, prefixes, and attached properties inside the Value of a Setter within a Style in XAML
  • Support for the "Frame.NavigationFailed" event
  • Added support for square brakets in the "Storyboard.TargetProperty" (for animating gradient stops for example)
  • Added polyfill for String.startsWith() for IE11
  • Improved compatibility with the "clr-namespace" syntax when a System assembly is referenced ("Migration Edition")
  • Tooltips now always stay within the screen bounds (previously, they could get cropped if they were close to the screen bounds)
  • Enums in XAML are now case-insensitive, for improved compatibility
  • Added support for prefixes in the "TargetProperty" path of storyboards in XAML
  • Removed the verbose logging of the TypeScript Definition files parser
  • Fine-tuned the warning when the CredentialsMode is not appropriate (CORS).
  • Improved the compilation error message when an element in the XAML does not have a x:Key.
  • Improved "Interop.loadJavaScriptFile" so that an exception is known if the specified JS script could not be loaded. Also improved "LoadJavaScriptFilesAsync" so that a callback can be specified in case of error.
  • Improved the performance of the <Path/> control
  • Moved the "TextDecorations" property to the class "Control" (rather than "TextBlock") so that it can be set on ContentPresenter to make styling easier
  • Support for "ServiceReferences.ClientConfig" for specifying the WCF configuration (in addition to "App.Config" which was already supported)
  • Support for the "XmlnsDefinition" attribute (in "AssemblyInfo.cs") to associate an URL to a namespace. Example:

    CODE: 

    [assembly:XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "Windows.UI.Xaml.Controls")]
    Note: like in WPF, it does not apply to the assembly itself but only to the assemblies that reference your assembly.
  • Improved support for TextBox templating. Here is an example of TextBox template with round corners:

    CODE: 

            <Style x:Key="TextBoxStyle1" TargetType="TextBox">
                <Setter Property=" HorizontalContentAlignment" Value="Right"/>
                <Setter Property=" VerticalContentAlignment" Value="Bottom"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="TextBox">
                            <Border x:Name="OuterBorder"
                                     Background="{TemplateBinding Background}"
                                     BorderBrush="{TemplateBinding BorderBrush}"
                                     BorderThickness="{ TemplateBinding BorderThickness}"
                                     Padding="4"
                                     CornerRadius="15">
                                <ContentPresenter x:Name="ContentElement"
                                                     Background="{TemplateBinding Background}"
                                                       Margin="{TemplateBinding Padding}"
                                                       HorizontalAlignment="Right"
                                                       VerticalAlignment="Bottom"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

 

Bug fixes:

  • Fixed binding of Width and Height properties
  • Fixed multiple issues with RadioButtons related to data binding
  • Fixed a UI layout issue that caused the Grid control to behave as if its HorizontalAlignment was set to Stretch
  • Fixed an issue where the ComboBox did not properly absorb events, preventing it from working property when placed inside other controls such as a RadioButton
  • Fixed an issue with KeyValuePair.GetHashCode() that caused unexpected behaviors for example when passing a collection of KeyValuePair as the ItemsSource of a ComboBox
  • Fixed an exception that occurred when calling methods from a ServiceReference that had no return type
  • Fixed an issue related to recursive initialization of "UTF8Encoding+UTF8EncodingSealed" with the latest April 2018 update of Windows 10
  • Fixed ChildWindow horizontal alignment
  • Fixed an issue with DataGrid under Firefox that caused it to grow bigger at each click
  • Fixed an issue where calling the default constructor of "BasicHttpBinding" did not properly initialize the Security property, leading to a NullReferenceException when accessing it
  • Fixed an issue where items inside a ListBox did not refresh correctly with data binding when no ItemTemplate was specified
  • Fixed data binding between a property of type Array and a property of type IEnumerable
  • Fixed an issue where OnPointerReleased was called twice for each click
  • Fixed an issue where e.OriginalSource in case of Button Click was null
  • Fixed the Simulator error that said that a control can only have one parent
  • Fixed error "System.InvalidCastException: Cannot cast to JSObject" that happened when resizing the Simulator if the page had navigated to a different URL.
  • Added a return value to HashSet2.Add method
  • Fixed an issue where defining a style would completely override the default style instead of extending it
  • Fixed alignment of text inside the buttons in the Calculator sample
  • Fixed an issue where "StringBuilder.Append" did not properly return the StringBuilder when running in the browser
  • The Simulator no longer crashes when an unhandled exception is raised in the user code
  • Fixed an issue where setting DataGrid.ItemsSource to null (after initialized with a collection) caused an exception.
  • Fixed the error when running in the browser related to "ComputeStringHash" that was sometimes raised when using a switch(string) statement in VS 2015 or newer
  • Added support for more elements in the XAML Editor preview (UriMapper, Behaviors, DataGrid.PageSize, etc.)
  • Added support for using the Style tag for the root of a XAML file
  • Fixed vertical alignment of shapes/paths
  • Fixed appearance of the DataPager under Firefox
  • Fixed an issue that, in some cases, could prevent from referencing from XAML a control defined in another assembly
  • Improved the reliability of DispatcherTimer when running in the Simulator
  • Fixed an issue with the Serialization and Deserialization of subclasses of IEnumerable
  • Fixed the issue that prevented defining multiple attached properties with the same name on different Types
  • Fixed an issue where the file "interopcalls.js" produced by the "Debug JS code...." feature of the Simulator (in the bottom-left corner) was incomplete
  • Fixed an issue where Rect.Contains would return an incorrect result under certain circumstances
  • Fixed an issue that caused the "Post Build" event to be executed twice, and in the wrong order (ie. it was executed before the compilation was complete)
  • Fixed an issue with WCF that occurred with web methods that have an abstract class, an interface, or a base type in their signature
  • Fixed an issue with WCF that occurred when one of the arguments of a web method was a generic type with 2 type generic type arguments (such as Dictionary<T1, T2>)
  • Fixed an issue with WCF that resulted in the wrong member being serialized, in case that both the [Serializable] and the [DataContract] attributes were present
  • Fixed an issue with the DataContractSerializer (and also with WCF) that resulted in the inherited properties of an object not being serialized in the correct order. The serializer now takes into account the classes hierarchy to determine the order of the properties in the XML.
  • Fixed support for running the generated HTML/JS application on a Linux-based server. There was an issue related to the fact that the resources are copied in lower case. Now they are still copied in lower case but the application code is now able to locate them.
  • Fixed an issue where ObservableCollection.OnPropertyChanged was not found
  • Fixed an issue that prevented ChildWindows from appearing if the "Show()" method was called from the constructor of the MainPage or before the main page was present in the Visual Tree
  • Fixed "Color.Equals", "Color.GetHashCode", equality and inequality operators
  • Fixed Duration implicit operator from TimeSpan.
  • Fixed WCF calls with IEnumerable as a parameter
  • Fixed an issue where moving of XElements from one container to another led to incorrect namespaces in Firefox and IE
  • Fixed an issue where the text in <Label Content="Test"/> was center-aligned instead of Stretch. Same with the direct text content of any ContentControl.
  • Fixed ChildWindow auto-size: if the ChildWindow becomes bigger than then browser size, its size gets constrained (like in Silverlight).
  • A ScrollViewer inside a ChildWindow now works as expected
  • Fixed "Frame.Navigated" event
  • Fixed binding of values within a RenderTransform (such RotateTransform)
  • Moved the "DataContext" property from "FrameworkElement" to "DependencyObject" as a workaround to enable inheritance through objects that are not of type FrameworkElement, such as Transforms.
  • Fixed multiple issues related to the processing of the "reference.cs" file (WCF)
  • Fixed an issue where the Simulator window would grow below the Windows task bar, which made it difficult to scroll and to access the "Tools" menu in the bottom-left corner of the Simulator
  • Fixed vertical alignment of the phone in the Simulator when the XAML inspector is open and the tree is expanded
  • Fixed a issue related to XmlWriter.WriteString
  • Fixed an issue that resulted in incorrect XML created by the XmlWriter when calling XmlWriter.WriteStartElement and then XmlWriter.WriteString without calling WriteStartAttribute in between.
  • Fixed autocompletion (intellisense) when working with TypeScript Definition files
  • Fixed a compilation error related to merged dictionaries when a dictionary was being merged with another dictionary defined in the same folder
  • Fixed an issue with the DataGrid that resulted in the DataPager not always being visible if the "DataGrid.VerticalAlignment" was "Stretch" rather than "Top".
  • Fixed a bug where the "Timeline" class would sometimes throw an exception when the TargetProperty is a nullable type (in JS)