Hello, im writting here because this is the only place on the internet that ive found some useful info about JSRT uwp projected namespaces.
Im working on a native xaml ui framework using JSRT, i had partial success loading XAML content and using it from javascript. Im using a very small executable that uses xaml islands on c++ and integrated jsrt, used JsProjectWinRTNamespace(L"Windows"); to expose all uwp namespaces, this is how i load content:
content = Windows.UI.Xaml.Markup.XamlReader.load(`<TextBlock Text="Hello from JSRT-UWP" Padding="20" Name="abc" HorizontalAlignment="Stretch" VerticalAlignment="Center" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" />`);
host.loadxaml(content)
content.text = "Hello from JSRT-UWP, edited from javascript";
content.textAlignment = 0;
So, breaking this, im using XamlReader to create xaml object from string, wich generates a [object Windows.UI.Xaml.Controls.TextBlock] using a native to plug this content on the xaml island, and following the type idl to work with it.
The native load part casts this object from IInspectable to UIElement and plug into the xaml island main content
Until here, everithing is good, but now i need to cast types in JSRT, for example from Windows.UI.Xaml.Controls.Button to Windows.UI.Xaml.Controls.Primitives.ButtonBase where i can effectively change the text of the button, or Windows.UI.Xaml.Controls.TextBlock to Windows.UI.Xaml.Controls.UIElement, wich allows to use AddHandler to use events, wich i need for this (i have to follow the idl and change the first letter to lowercase)
I tried to create a native and cast from xxxx to UIElement but JSRT always return the same main type. Any idea on how i could cast there?
PS: i know about react-native-windows project, they use corewindow to create a catch-all event handler and pass to JS, but i dont like this approach, nor like react at all, so im still exploring my way...
Hello, im writting here because this is the only place on the internet that ive found some useful info about JSRT uwp projected namespaces.
Im working on a native xaml ui framework using JSRT, i had partial success loading XAML content and using it from javascript. Im using a very small executable that uses xaml islands on c++ and integrated jsrt, used
JsProjectWinRTNamespace(L"Windows");
to expose all uwp namespaces, this is how i load content:So, breaking this, im using XamlReader to create xaml object from string, wich generates a
[object Windows.UI.Xaml.Controls.TextBlock]
using a native to plug this content on the xaml island, and following the type idl to work with it.The native load part casts this object from IInspectable to UIElement and plug into the xaml island main content
Until here, everithing is good, but now i need to cast types in JSRT, for example from
Windows.UI.Xaml.Controls.Button
toWindows.UI.Xaml.Controls.Primitives.ButtonBase
where i can effectively change the text of the button, orWindows.UI.Xaml.Controls.TextBlock
toWindows.UI.Xaml.Controls.UIElement
, wich allows to use AddHandler to use events, wich i need for this (i have to follow the idl and change the first letter to lowercase)I tried to create a native and cast from xxxx to
UIElement
but JSRT always return the same main type. Any idea on how i could cast there?Do you know any way i could achive type casting?
Regards!
PS: i know about
react-native-windows
project, they use corewindow to create a catch-all event handler and pass to JS, but i dont like this approach, nor like react at all, so im still exploring my way...