locked
Is it possible to combine HTML5/JavaScript and XAML/C# within single app? RRS feed

  • Question

  • I know that you can create Win8 Metro style apps in HTML5 and JavaScript or XAML and C#/VB.NET.  I'm not sure which path I prefer and obviously nobody knows which will be more successful in the job marketplace. 

    Is there a way to combine both paths within a single app?

    Tuesday, January 3, 2012 2:22 PM

Answers

  • The UI layer can be one of HTML, Xaml, or DirectX. These cannot be directly mixed. Underlying code can mix C#, JavaScript, C++ as Jeff indicated.

    You can view HTML files in Xaml via the WebView control, but that doesn't give full browser control like a full HTML/JavaScript app has.

    --Rob

    Monday, January 9, 2012 8:05 PM
    Moderator

All replies

  • Yes you can:

    You can create WinMD components in C# for example and call them from Javascript.  See this:

    http://msdn.microsoft.com/en-us/library/windows/apps/br230301(v=vs.110).aspx

     

    -Jeff

     


    Jeff Sanders (MSFT)
    Tuesday, January 3, 2012 3:39 PM
    Moderator
  • What I want to do is to combine in HTML5/JavaScript and XAML/C# in the same app.   Is this possible?
    Monday, January 9, 2012 7:31 PM
  • The UI layer can be one of HTML, Xaml, or DirectX. These cannot be directly mixed. Underlying code can mix C#, JavaScript, C++ as Jeff indicated.

    You can view HTML files in Xaml via the WebView control, but that doesn't give full browser control like a full HTML/JavaScript app has.

    --Rob

    Monday, January 9, 2012 8:05 PM
    Moderator
  • The UI layer can be one of HTML, Xaml, or DirectX. These cannot be directly mixed. Underlying code can mix C#, JavaScript, C++ as Jeff indicated.

    You can view HTML files in Xaml via the WebView control, but that doesn't give full browser control like a full HTML/JavaScript app has.

    --Rob


    OK, I kind of figured that this wasn't possible.  Maybe I'll write my app twice.
    Monday, January 9, 2012 8:10 PM
  • It is possible to render XAML over the top of a DirectX surface, This is helpful if you want to create a menu or HUD interface and render it over the top of a 3D game or simulation software.

    Is this just a general question, or do you have something more definitive in mind your wish to accomplish?


    Wednesday, August 1, 2012 11:10 PM
  • Yes, it is possible and there are a couple ways to do that.  See this article: http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx

    Joe


    Thursday, September 27, 2012 5:22 PM
  • Can you check that link? It's 404
    Tuesday, December 11, 2012 6:57 PM
  • Hi ResQue1980,

    Note that this thread was from an earlier preview before Xaml/DirectX interop was implemented. We're still trying to get the old threads archived, but in the meantime please check the date and post a new thread rather than bumping an old one with out-of-date information.

    --Rob

    Tuesday, December 11, 2012 10:01 PM
    Moderator