Can XAML be used with JavaScript in WinRT?
Or JavaScript is only restricted to HTML? I'v开发者_开发知识库e only seen HTML-JavaScript demos at Build 2011
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.
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.
精彩评论