The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

[UWP]C# WinRT Xaml Controls in WinJS application RRS feed

  • Question

  • Hi All,

    I have created WinJS application. For some reason I need to load XAML controls using WinRT component approach. But I am getting wrong thread exception: "The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))".

    My questions are:

    1. Can we use Windows.UI.Xaml.Controls.Button or Windows.UI.Xaml.Controls.Frame controls in WinJS application?

    2. Is there any other approach to achive?

    My Requirement:

    1. We have written lots of code in C#, My clients will have JavaScript knowledge, he writes his own functions using Windows JavaScript API(provided by MS). We need to have support of combination : Windows C# API and Windows JS API.

    Solution: We can achieve this  using Chakra Engine APIs.

    2. We have written lots of XAML controls code. My client will have HTML knowledge, he designs pages in HTML. We need to support both XAML and HTML.

    Solution: We can achieve this using WebView control.

    Finally, We need the combination of 1 & 2.

    Is there any solutions available here?


    Pallam Madhukar Windows Phone Developer

    Monday, August 1, 2016 2:09 PM


  • Hi Pallarm Madhukar   

    >>Can we use Windows.UI.Xaml.Controls.Button or Windows.UI.Xaml.Controls.Frame controls in WinJS application?

    No you can't. WinJS Application and UWP(C#) use different render engine to render contents on page. So it is not possible to render a XAML Control in WinJS APP.

    >>Is there any other approach to achive?

    Currently there is no other approach, webview only support web context ,which means you can't call windows API in webview.



    Best Regards, Sunteen Wu

    • Edited by Sunteen Wu Wednesday, August 3, 2016 8:08 AM
    • Proposed as answer by Sunteen Wu Friday, August 12, 2016 7:36 AM
    • Marked as answer by Xavier Xie-MSFT Thursday, August 18, 2016 12:07 PM
    Wednesday, August 3, 2016 8:08 AM