What should I learn to be able to code in C#/XAML for HTML5?

Posts: 1
Joined: Mon Jul 13, 2015 9:33 am

What should I learn to be able to code in C#/XAML for HTML5?

Postby crossxaml » Mon Jul 13, 2015 9:57 am

I'm very new to C#/XAML, but I know that if I can take the same codebase and apply it to web dev, mobile dev, and desktop/tablet dev, then life becomes that much easier. However, what should I be learning exactly? Which of these development paths is closest to how someone would code in C#/Xaml for HTML 5?

There's already:
  • WPF
  • Silverlight
  • Silverlight for WP 7/7.5/7.8
  • C#/Xaml for Win 8/8.1 (desktop)
  • C#/Xaml for WP 8/8.1 (mobile)
  • C#/Xaml for Win 10 (desktop)
  • C#/Xaml for WP 10 (mobile)

Which of these should I be learning to be able to code for C#/Xaml for HTML 5? Another way of putting it, which of these platforms are closest in code and approach to C#/Xaml for HTML 5?

Also how much conversion from any of the platforms above, if any, will have to happen to be able to port to C#/Xaml for HTML 5?

* C#/Xaml for HTML 5 - a shorter name or acronym would be nice :)

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

Re: What should I learn to be able to code in C#/XAML for HTML5?

Postby JS-Support @Userware » Wed Jul 15, 2015 9:11 am

Hi crossxaml,

Thanks for your message and welcome to the forums.

The short name for C#/XAML for HTML5 is CSHTML5 (it's like the website domain: cshtml5.com).

In terms of XAML syntax, namespaces, and features, the closest one is Windows Universal Apps, which is the new Microsoft XAML standard for developing Windows 8/10, Windows Phone 8.1+ and XBox apps. You can see it when under Visual Studio you click File -> New Project -> Store Apps (or Universal Apps) and choose any of the said platforms.

However we are doing our best to be as much compatible as possible with also the other platforms, such as Silverlight (which is very similar to Universal Apps, except for the namespaces), and WPF (which has way more features than the other platforms).

For example, in XAML, we support both ways of referencing XAML namespaces: the new way (xmlns:local="using:MyNamespace") and the old Silverlight/WPF way (xmlns:local="clr-namespace:MyNamespace;assembly=MyAssembly").

As far as C# is concerned:
- The classes are very similar for all those platforms. CSHTML5 supports a small subset (documentation is coming very soon).
- The C# syntax supported by CSHTML5 is C# 5.0, so it includes all the language features you need. It supports even more language features than Silverlight, such as async/await that is not supported in Silverlight 5.
- As far as the namespaces are concerned, we use the namespaces of Universal Apps. People who want to share code with Silverlight or WPF apps can easily do so by placing compiler directives around the namespaces ("#if CSHTML5"). For example:

Code: Select all

  using Windows.UI.Xaml;
  using Windows.UI.Xaml.Controls;
  using System.Windows;
  using System.Windows.Controls;

Please feel free to let me know if something is not very clear or if you have any other questions.

Best regards,

Return to “General Discussion and Other”

Who is online

Users browsing this forum: No registered users and 1 guest