locked
Can Javascript metro use Windows.UI.Text or any of the Windows.UI.Xaml,* namespace ?

    Question

  • Can Javascript metro use any of the Windows.UI.Xaml,*  namespace ?

    It seems they are unusable on javascript ? There is no example for javascript, and can javascript use Windows.UI.Text ?

    Why are they on the documentation for javascript ? are they usable ? can they be usable later after updates to WIndows 8 maybe ?

    Monday, June 18, 2012 9:24 PM

Answers

  • That is correct.  The types that are WebHostHidden are not available in JS, because they are specific to XAML UI, used by non-JS apps.  You should be able to find an equivalent JS solution by using HTML/CSS/etc. 
    Monday, June 18, 2012 11:09 PM

All replies

  • No, these APIs are not usable from JavaScript, because they are Xaml specific and are not meant to be used in JavaScript apps. If a type has the WebHostHiddenAttribute() in its list of attributes it is not usable from JS.  As you observed, this is the case with all types in Windows.UI.Text as well as those in some other Xaml namespaces.

    I assume by "on the documentation for JavaScript" you mean the link to Windows API: Windows Runtime and Windows Library for JavaScript.  This link points to the same page for C# and C++ as well, so the page includes all the Windows Runtime types, whether or not they are usable from JS.

    Hope that helps clear things up.

    Monday, June 18, 2012 9:41 PM
  • Thanks for the info Caroline G Murdoch, is there equivalent classes and namespace for those classes, namespace that are not available for javascript , in javascript ? or are there are none ?

    I assume since they are not available in js, they are not very important and can be simulated in javascript maybe using CSS, etc etc ?

    Monday, June 18, 2012 11:02 PM
  • That is correct.  The types that are WebHostHidden are not available in JS, because they are specific to XAML UI, used by non-JS apps.  You should be able to find an equivalent JS solution by using HTML/CSS/etc. 
    Monday, June 18, 2012 11:09 PM
  • Ok, thanks for the information Caroline, that helps. I really appreciates it.
    Monday, June 18, 2012 11:24 PM
  • Is it possible in the future that those namespaces are removed from the javascript Metro documentation ? To make it more readable ? Or maybe marked so that people like me won't click it ?

    the documentation would be more readable in my belief.

    Monday, June 18, 2012 11:32 PM
  • As I mentioned before, the Windows API documentation is shared for all supported app languages, so these namespaces can't be removed, as they are callable from C++ and C#.  I do agree, however, that the fact that these are not available in JS could be more clear.  Currently it seems that you either need to be familiar with the meaning of the WebHostHiddenAttribute or infer from the lack of JS samples that they aren't available.  I'll make sure this feedback gets to the documentation owners.
    Tuesday, June 19, 2012 2:36 AM