« October 2012 | Main | December 2012 »

November 2012

Windows Store Apps with XAML or HTML?

Writing Windows Store apps for Windows 8 can be done with C# or C++ and XAML, or with JavaScript and HTML. What is the best option to do this?

In reality, the choice usually isn’t that hard. If you already have a rich client application that was done with XAML and C# (WPF), and a subset of this functionality should be offered for Windows Store apps, the easiest option to do this is to choose XAML and C#. You can build up on your knowledge on developing with C# and XAML. And it’s also possible to share code between desktop apps with WPF and Windows Store apps by using the Portable Class Library. With this project type you can select the frameworks that should be supported, e.g. .NET 4.5, Windows Phone 8, and .NET for Windows Store apps:

image

Of course the design of the WPF app needs to be changed to fulfill the new Microsoft Design guidelines, and to integrate with the charms bar, put commands into the app bar, and more.

In case you’ve an existing Web application that was done with HTML and JavaScript, and this should be enhanced with features for Windows Store apps, the choice will be using HTML and JavaScript for the Windows Store app.

You cannot do everything directly from JavaScript that can be done from .NET. With most apps you may not see the differences, just if you do something special such as using advanced printer features such as selecting another tray or automatically stapling. On the other side, using JavaScript has some other advantages such as easy CSS3 styling for documents, or more out-of-the-box controls such as flyout, rating, or date selection.

You can also write some C# or C++ code to use it from JavaScript by creating a Windows Runtime component. Such a library can be used by JavaScript, C#, and C++ apps. Just don’t use this library if the technologies you build upon are just .NET based. With Windows Runtime components you’re restricted to public sealed types, and types defined by the Windows runtime. If you are just using .NET technologies, you’re much better with the portable class library.

And of course, if you have a C++ desktop application, you can take the knowledge to write C++ apps for the Windows Store. XAML is now a great offer for C++ as well.

To summarize, you can utilize knowledge and code if you’ve an existing C# desktop application to create a Windows Store app with XAML and C#, and extending Websites that offer HTML and JavaScript can make use of Windows Store apps with HTML and JavaScript. Of course if you’ve already a rich app with JavaScript, the choice for the Windows Store app would be JavaScript as well.

Christian

CN innovation