Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can XAML be used with JavaScript in WinRT?

Or JavaScript is only restricted to HTML? I've only seen HTML-JavaScript demos at Build 2011

like image 392
Alice Avatar asked Sep 23 '11 14:09

Alice


2 Answers

XAML is not supported in JavaScript Metro apps - those classes are specifically hidden from JavaScript WinRT projection.

This actually includes not just the stuff under Windows.UI.Xaml, but also some other classes elsewhere, usually when they do something that is already covered by JS standard library (with HTML5 extensions). The easiest way to see what exactly is hidden is to inspect WinRT .idl files (in "C:\Program Files (x86)\Windows Kits\8.0\Include\winrt") and search for webhosthidden. Those interfaces which have [webhosthidden] attribute applied to them are not visible from JS. Sometimes you'll also see comments explaining why a particular interface is hidden.

like image 153
Pavel Minaev Avatar answered Nov 17 '22 21:11

Pavel Minaev


Not yet. XAML is used only from C# or C++, and for JavaScript you need HTML5.

One of reasons is that in case of HTML + JavaScript the same engine as in IE10 is used for rendering. (By the way, Metro version of IE10 doesn't support plugins like Silverlight.)

The other currently missing area is that you cannot use ASP.NET / ASP.NET MVC to build metro style applications, which would allow combining C# and HTML.

like image 1
Roman Boiko Avatar answered Nov 17 '22 19:11

Roman Boiko