locked
WinJS: How to create and use custom WinRT control? RRS feed

  • Question

  • Hi,

    I have recently struct with problem: We can't load are use Windows/WinJS API inside webView. So I have taking approach building WinJS application and use existing code.

    1. I have converted my existing C# project to UWP Runtime component.  

    2. I have Created WinJS application.

    3. Now, I am able to add C# UWP Runtime Component reference to WinJS project. 

    4. In order to use the existing C# controls, I need to run C# code on UI thread, but I am not able to get the UI thread using below code.

    Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                () =>
                {
                    var btn= new Windows.UI.Xaml.Controls.Button();
                });

    How to I use existing custom controls in WinJS?

    Please help me. 

    Thanks,

    Pallam Madhukar


    Pallam Madhukar Windows Phone Developer

    Monday, August 1, 2016 9:17 AM

Answers

  • Hi Pallam,

    >>How to I use existing custom controls in WinJS?

    As far as I know, UWP(Javascript) use the Edge render engine. which is only able to parse html contents.

    So, it is impossible to use an existing XAML Control inside a WinJS Project.

    WinJS has its own controls, which looks like quite the same as XAML Controls.Please use these WinJS Controls instead.

    You can find the playground of WinJS Controls by this link: http://try.buildwinjs.com/playground/.


    Wednesday, August 3, 2016 4:22 AM