Skip to main content

Metro Apps on Window 8 - What to use? XAML/HTML? JavaScript, C#, C++?

Windows 8 is almost released, a lot of companies started already to develop application for Windows 8 – Metro Applications.
In a Metro Application we have three technologies to render the UI:
  • JavaScript
  • C#
  • C++
And yes, VB, but is on the same level with C#. With this three languages we can use HTML and CSS, DirectX and XAML but not in any combination.
On the first level we have DirectX for the UI. This can be used only from C++. Of course we can define libraries that can be consumed by C# and JavaScript code.
The second way to create UI is using XAML. We can use XAML in C# (VB) and C++. The big difference in comparison with DirectX is that we cannot use an XAML controller in a JavaScript application. In this moment we don’t have a JavaScript component that permits us to display a XAML (and I don’t think that we will see soon).
On the same level as XAML we have HTML5 and CSS. This can use only JavaScript and don’t permit to create WinMD libraries that can be consumed by C# and C++. We don’t have any kind of support of JavaScript in C++/C#.
What nice things we can do? We can have a DirectX library and over it an XAML as overlay. This is a very powerful for game industry that can use XAML for data binding and interface and in the same time to use DirectX for the game UI.
After 4 months working with JavaScript and C# on Metro Application on Windows 8 I can say:
  • XAML can bind to everything (we have in JavaScript and HTML – but the performance is not the best)
  • Dependency property – we can bind 10.000 properties to the UI without any problem (I saw a HTML/JS implementation and it took over 20 seconds to bind and render all the data)
  • OOP – is nice to work with a functional programming language (but I miss OOP)
  • MVVM – in this moment this pattern is well defined for XAML solutions and a lot of MVVM frameworks already support it
  • Debugging – full debugging support as intellisense, code analysis and symbolic refactoring
  • Vectors – can be done in HTML5, but I prefer to work with them from XAML
  • Resolution independence – don’t need to say more
In conclusion I don’t want to say that XAML is better than HTML5. No, this is not the idea of the blog post. But be aware when you want to use XAML or HTML about what limitation can bring with them. For example in XAML/C# we cannot load dynamically WinMD libraries. But we can load and execute JavaScript at runtime.


  1. Interesting - anyway, about "What to use?" - the answer is simple - what your team has more experience in. Very, very few developers are equally experienced in XAML and HTML5/JScript, or in both C# and C++.
    For a programmer that used C++ and MFC for the last 10 years, getting up to speed with C# and XAML in 5 days is not an option.

    1. I would not say to use only the language that you know. A technology can be learned, is not so hard. We need to realize that there is some limitation when we use one HTML/JS or XAML/C# or DirectX/C++. We need to take this account before starting the project and see also what language can make us happy.

    2. Of course - I meant to say - what technology to use when a team of let's say 10 people is asked by a client to start to implement an application _now_, and have it released in production in 2 months - in such cases, which are the norm in most companies, the developers are happy if they have 4 days before the project starts to get up to speed with some new technology.

      Sure, when somebody has plenty of time before a project starts (months), it will also have time to switch platforms, learn something new etc..

    3. To give you a clearer example:
      You cannot do dynamic loading of code (assembly) in XAML/C# metro application. But using JavaScript and HTML5 this is possible. In the same time it is easier to use C++ and DirectX in a XAML application than in HTML5 and JavaScript. And you don’t want to have 1000 bindings in a HTML/JavaScript application; you will need more than 2 seconds to load the page.
      What is the scope of your application? What you will do in it? What we need to in our application? This is the most important question. Quality software cannot be developed only because we know a technology. We need to know a lot of technologies and know what is the most suitable for our application. You don’t want in version 2 or 3 to have a blocker because you didn’t use a suitable technology.

    4. Indeed, this is the best approach - when possible, evaluate the most appropriate technology and use that.
      If you have developers skilled in multiple technologies, or time to train them in advance, it's best.

      Otherwise, when a company has only 20 developers, and 10 or them have just finished working 4 years for a big project in WPF, then the company finds another project that must be developed for Win8/Metro, and the company has won the bid against other companies because they promised to finish it in 3 months, what do you do? :)
      Turn down the client because maybe JS/HTML5 is more appropriate in some cases, or use the technology that the developers know?

      About: "You cannot do dynamic loading of code (assembly) in XAML/C# metro application" if it's true, this is a very strange limitation, because it was possible until now. Anyway, the cases when this is needed, are rare in normal applications.

    5. “Anyway, the cases when this is needed, are rare in normal applications.”
      In a LoB application dynamic loading is a have to in many cases. They don’t allow this for security reason and I try to understand them (only try). Maybe a Prism for Metro Application will be launched soon and all our problems will be solved

    6. Somehow it's logical - since a Metro app is a sandboxed app that must be pre-approved by Microsoft in order to run (usually), and dynamically loading is usually used for plugins/extensions that are not installed in advance, such a restricted application can't use plugins that are not yet verified by Microsoft.
      Maybe in future they will develop a MEF version for Metro that allows this (

    7. I'm waiting this version of MEF for Metro Apps and also I hope that they will support HTML and JS.

  2. Also you'll have to take in consideration what type of application you're developing, what features need to have and the complexity of the app. Based on these things you'll decide the right solution to use.
    This is the path of decision making in my company.


Post a Comment

Popular posts from this blog

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

Fundamental Books of a Software Engineer (version 2018)

More then six years ago I wrote a blog post about fundamental books that any software engineer (developer) should read. Now it is an excellent time to update this list with new entries.

There are 5 different categories of books, that represent the recommended path. For example, you start with Coding books, after that, you read books about Programming, Design and so on.
There are some books about C++ that I recommend not because you shall know C++, only because the concepts that you can learn from it.


Writing solid codeCode completeProgramming Pearls, more programming pearls(recommended)[NEW] Introduction to Algorithms


Refactoring (M. Fowler)Pragmatic ProgrammerClean code[NEW] Software Engineering: A Practitioner's Approach[NEW] The Mythical Man-Month[NEW] The Art of Computer Programming


Applying UML and Patterns (GRASP patterns)C++ coding standards (Sutter, Alexandrescu)The C++ programming language (Stroustrup, Part IV)Object-oriented programming (Peter Coad)P…