XAML 可以与 WinRT 中的 JavaScript 一起使用吗?
或者 JavaScript 仅限于 HTML?我只在 Build 2011 上看过 HTML-JavaScript 演示
Or JavaScript is only restricted to HTML? I've only seen HTML-JavaScript demos at Build 2011
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
JavaScript Metro 应用程序不支持 XAML - 这些类在 JavaScript WinRT 投影中专门隐藏。
这实际上不仅包括
Windows.UI.Xaml
下的内容,还包括其他地方的一些其他类,通常是当它们执行 JS 标准库(带有 HTML5 扩展)已经涵盖的操作时。查看到底隐藏了什么的最简单方法是检查 WinRT .idl 文件(位于“C:\Program Files (x86)\Windows Kits\8.0\Include\winrt”中)并搜索webhosthidden
。那些应用了[webhosthidden]
属性的接口在 JS 中是不可见的。有时您还会看到解释为什么隐藏特定界面的注释。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 forwebhosthidden
. 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.还没有。 XAML 仅在 C# 或 C++ 中使用,对于 JavaScript,您需要 HTML5。
原因之一是,在 HTML + JavaScript 的情况下,使用与 IE10 中相同的引擎进行渲染。 (顺便说一句,Metro 版本的 IE10 不支持 Silverlight 之类的插件。)
当前缺少的另一个领域是您无法使用 ASP.NET / ASP.NET MVC 构建 Metro 风格应用程序,这将允许组合 C# 和 HTML。
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.